✓ Accepted answer
This already won't work because you're using 'KeyDown' wich is deprecated and will not work anymore, use userinputservice instead.
Not sure where your script is but most of the time player isn't the parent, (mostly playergui or backpack)
Also, you're thinking humanoid is located inside the player wich is not the case, it's located inside the character
So a better script would be
local UserInputService = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
function onInputBegan(input,gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftShift then
local char = Player.Character
if char then
local h = char:WaitForChild('Humanoid')
h.WalkSpeed = 50
end
end
end
function onInputEnded(input,gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftShift then
local char = Player.Character
if char then
local h = char:WaitForChild('Humanoid')
h.WalkSpeed = 16
end
end
end
UserInputService.InputBegan:connect(onInputBegan)
UserInputService.InputEnded:connect(onInputEnded)
This needs to be a local script in any client area.
If you have any questions, just ask :)
2 comments
Thanks ! Worked
Np :)