so basically this local script under starterplayerscripts is suppose to make the player run when they press leftcontrol but for some reason its not working and i cant seem to find out why?
local players = game:GetService("Players")
local locpl = players.LocalPlayer
local UserInputServer = game:GetService("UserInputService")
local humanoid = locpl.Character:FindFirstChild("Humanoid")
local Ranimation = game.StarterPlayer.StarterCharacterScripts.RUN.RunAnim
local playit = humanoid:LoadAnimation(Ranimation)
UserInputServer.InputBegan:Connect(function(input)
if input == Enum.KeyCode.LeftControl then
if locpl.Character:FindFirstChild("Humanoid") then
locpl.Character:FindFirstChild("Humanoid").WalkSpeed = 30
playit:Play()
end
end
end)
UserInputServer.InputEnded:Connect(function()
locpl.Character:FindFirstChild("Humanoid").WalkSpeed = 16
playit:Stop()
end)
This needs to be input.KeyCode == Enum.KeyCode.LeftControl instead. Additionally, you should edit the input ended function to make sure the input is also LeftControl so that when releasing a different key, it doesn’t stop the running.
local players = game:GetService("Players")
local locpl = players.LocalPlayer
local UserInputServer = game:GetService("UserInputService")
local humanoid = locpl.Character:FindFirstChild("Humanoid")
local Ranimation = game.StarterPlayer.StarterCharacterScripts.RUN.RunAnim
local playit = humanoid:LoadAnimation(Ranimation)
UserInputServer.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
if locpl.Character:FindFirstChild("Humanoid") then
locpl.Character:FindFirstChild("Humanoid").WalkSpeed = 30
playit:Play()
end
end
end)
UserInputServer.InputEnded:Connect(function()
locpl.Character:FindFirstChild("Humanoid").WalkSpeed = 16
playit:Stop()
end)