What I am making, is that you can hold down shift, or X on an Xbox 360 controller, to go twice the normal humanoid walkspeed. The issue i'm having is that when I go to test this, it does not do what it's supposed to do, and no errors and reported in the output! Here's the code below:
--Shift to run! local player = game.Players.LocalPlayer local humanoid = player.Character.Humanoid local userInputService = game:GetService("UserInputService") local function Run() humanoid.WalkSpeed = 32 end if userInputService:IsKeyDown(16) or userInputService:IsGamepadButtonDown(2) then Run() end
Hi Atomic,
--Shift to run! local player = game.Players.LocalPlayer -- Removed Humanoid because it's better to define inside of the function since it gets updated and it just looks neater. local userInputService = game:GetService("UserInputService") function Run(obj, gp) local char = player.Character or player.CharacterAdded:Wait(); local hum = char:WaitForChild("Humanoid"); -- Shift For Computer Users -- if obj.KeyCode == Enum.KeyCode.LeftShift and not gp then hum.WalkSpeed = 32; end -- Shift For Computer Users -- -- Shift For Xbox Users (Not entirely sure, just followed Wiki since I've never done it before) -- if obj.UserInputType == Enum.UserInputType.Gamepad1 then if obj.KeyCode == Enum.KeyCode.ButtonX then hum.WalkSpeed = 32; end end -- Shift For Xbox Users (Not entirely sure, just followed Wiki since I've never done it before) -- end userInputService.InputBegan:Connect(Run);
Thanks,
Best regards,
~~ KingLoneCat