-- Toggle Key: Right Shift (fixed by troll9778) -- 1. SERVICES -- We get these services first to make the script efficient. local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local CoreGui = game:GetService("CoreGui") local StarterGui = game:GetService("StarterGui") local player = Players.LocalPlayer -- 2. ANTI-DUPLICATE -- Checks if the menu already exists and removes it to prevent stacking. if CoreGui:FindFirstChild("ScriptHub") then CoreGui.ScriptHub:Destroy() elseif player.PlayerGui:FindFirstChild("ScriptHub") then player.PlayerGui.ScriptHub:Destroy() end -- 3. VARIABLES & SETTINGS local flying = false local speedOn = false local infJumpOn = false local noclipOn = false local FLY_SPEED = 70 local SPEED_AMOUNT = 75 -- 4. GUI CREATION local gui = Instance.new("ScreenGui") gui.Name = "ScriptHub" -- IMPORTANT: Prevents the GUI from deleting when you die gui.ResetOnSpawn = false -- Attempt to put in CoreGui (Secure), fallback to PlayerGui (Standard) pcall(function() gui.Parent = CoreGui end) if gui.Parent ~= CoreGui then gui.Parent = player:WaitForChild("PlayerGui") end local frame = Instance.new("Frame", gui) frame.Size = UDim2.new(0, 260, 0, 320) frame.Position = UDim2.new(0.5, -130, 0.5, -160) frame.BackgroundColor3 = Color3.fromRGB(25, 25, 25) frame.Active = true frame.Draggable = true -- Allows you to move the menu frame.Visible = true -- Title Label local title = Instance.new("TextLabel", frame) title.Size = UDim2.new(1, 0, 0, 40) title.BackgroundTransparency = 1 title.Text = "⚡ Script Hub" title.TextColor3 = Color3.new(1, 1, 1) title.Font = Enum.Font.SourceSansBold title.TextSize = 22 -- 5. BUTTON GENERATOR -- Helper function to create buttons easily local function makeButton(text, y) local b = Instance.new("TextButton", frame) b.Size = UDim2.new(0.9, 0, 0, 40) b.Position = UDim2.new(0.05, 0, 0, y) b.BackgroundColor3 = Color3.fromRGB(40, 40, 40) b.TextColor3 = Color3.new(1, 1, 1) b.Font = Enum.Font.SourceSansBold b.TextSize = 18 b.Text = text return b end local flyBtn = makeButton("Fly: OFF", 50) local speedBtn = makeButton("Speed: OFF", 100) local jumpBtn = makeButton("Inf Jump: OFF", 150) local noclipBtn = makeButton("NoClip: OFF (N)", 200) local closeBtn = makeButton("Close Hub", 260) -- 6. CORE LOGIC (Fly, Speed, etc) -- Fly Function local function startFly() flying = true local char = player.Character if not char then return end local hum = char:FindFirstChild("Humanoid") if hum then hum.PlatformStand = true end RunService:BindToRenderStep("FlyLoop", Enum.RenderPriority.Camera.Value, function(dt) if not flying then RunService:UnbindFromRenderStep("FlyLoop") return end local char = player.Character if not char then return end local hrp = char:FindFirstChild("HumanoidRootPart") if not hrp then return end local cam = workspace.CurrentCamera local moveVec = Vector3.new() -- Controls if UIS:IsKeyDown(Enum.KeyCode.W) then moveVec = moveVec + cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.S) then moveVec = moveVec - cam.CFrame.LookVector end if UIS:IsKeyDown(Enum.KeyCode.A) then moveVec = moveVec - cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.D) then moveVec = moveVec + cam.CFrame.RightVector end if UIS:IsKeyDown(Enum.KeyCode.Space) then moveVec = moveVec + Vector3.new(0, 1, 0) end if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then moveVec = moveVec - Vector3.new(0, 1, 0) end if moveVec.Magnitude > 0 then hrp.CFrame = hrp.CFrame + moveVec.Unit * FLY_SPEED * dt end hrp.AssemblyLinearVelocity = Vector3.zero end) end local function stopFly() flying = false RunService:UnbindFromRenderStep("FlyLoop") if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.PlatformStand = false end end -- Noclip Function RunService.Stepped:Connect(function() if noclipOn and player.Character then for _, v in pairs(player.Character:GetDescendants()) do if v:IsA("BasePart") and v.CanCollide == true then v.CanCollide = false end end end end) local function toggleNoClip() noclipOn = not noclipOn noclipBtn.Text = noclipOn and "NoClip: ON (N)" or "NoClip: OFF (N)" end -- 7. BUTTON EVENTS flyBtn.MouseButton1Click:Connect(function() if flying then stopFly() flyBtn.Text = "Fly: OFF" else startFly() flyBtn.Text = "Fly: ON" end end) speedBtn.MouseButton1Click:Connect(function() speedOn = not speedOn local hum = player.Character and player.Character:FindFirstChild("Humanoid") if hum then hum.WalkSpeed = speedOn and SPEED_AMOUNT or 16 end speedBtn.Text = speedOn and "Speed: ON" or "Speed: OFF" end) jumpBtn.MouseButton1Click:Connect(function() infJumpOn = not infJumpOn jumpBtn.Text = infJumpOn and "Inf Jump: ON" or "Inf Jump: OFF" end) noclipBtn.MouseButton1Click:Connect(toggleNoClip) -- Close Button (Hides ONLY) closeBtn.MouseButton1Click:Connect(function() frame.Visible = false StarterGui:SetCore("SendNotification", { Title = "Script Hub Hidden"; Text = "Press Right Shift to reopen!"; Duration = 3; }) end) -- 8. INPUT HANDLING (Keys) UIS.JumpRequest:Connect(function() if infJumpOn and player.Character then local hum = player.Character:FindFirstChild("Humanoid") if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end end) UIS.InputBegan:Connect(function(input, gpe) -- Toggle Menu if input.KeyCode == Enum.KeyCode.RightShift then frame.Visible = not frame.Visible end -- Noclip Hotkey (Ignore if typing in chat) if not gpe and input.KeyCode == Enum.KeyCode.N then toggleNoClip() end end) -- 9. RESPAWN HANDLING -- Ensures features work after dying player.CharacterAdded:Connect(function(char) local hum = char:WaitForChild("Humanoid", 5) if hum and speedOn then hum.WalkSpeed = SPEED_AMOUNT end -- Reset Fly to avoid glitching if flying then stopFly() flyBtn.Text = "Fly: OFF" end end) -- Initial Notification StarterGui:SetCore("SendNotification", { Title = "Script Loaded"; Text = "Press Right Shift to Toggle Menu"; Duration = 5; })