#Help

1 messages · Page 1 of 1 (latest)

hexed palm
#

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local runAnimId = "rbxassetid://95424326302208" -- ✅ Your animation ID
local runSpeed = 26
local walkSpeed = 16

local humanoid = nil
local animTrack = nil
local running = false

local runAnim = Instance.new("Animation")
runAnim.AnimationId = runAnimId

-- Start running
local function startRunning()
if humanoid and not running then
running = true
humanoid.WalkSpeed = runSpeed

    animTrack = humanoid:LoadAnimation(runAnim)
    animTrack.Priority = Enum.AnimationPriority.Action
    animTrack:Play()
end

end

-- Stop running
local function stopRunning()
if humanoid and running then
running = false
humanoid.WalkSpeed = walkSpeed
if animTrack then
animTrack:Stop()
animTrack:Destroy()
animTrack = nil
end
end
end

-- Character loaded
local function onCharacterAdded(character)
humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = walkSpeed
end

-- Connect character and input events
player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then onCharacterAdded(player.Character) end

UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
startRunning()
end
end)

UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
stopRunning()
end
end)

I dont know but it wont wort Ive been trying for hours on hours it wont work, output said everything is fine

terse marsh
#

well this is obviously dodo ai code

#

but instead of character added function

#

just do character = player.Character or player.CharacterAdded

#

best guess is humanoid is still nil

#

print humanoid after the if statements in startrunning and stop running

#

it may print nil

marble talon
#

Whats not working? it works for me

#

did u store script in right place? (try in starterplayer > startercharacterscripts if you dont kniow ) make sure its a local script You could try making your own animation, using smn elses id doesnt work sometimes (assuming its not since the comment from ai)

fast fable
#

Search up a lil tutorial

hexed palm
hexed palm
#

Alr highly appreciated