You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I have a custom StarterCharacter model that I made a running animation for. I’m trying to have it play only when the walkspeed of the player is 30, and only when they move.
-
What is the issue? I just can’t seem to figure out how.
-
What solutions have you tried so far? I’ve tried Discord, but either was ignored or told to read the forums, but those got me no where.
wait(2)
local LocalPlayer = game.Players.LocalPlayer
local Sprint = game.Workspace.Sprint
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local myChar = game.Players.LocalPlayer.Character or game.Player.LocalPlayer.CharacterAdded:wait()
local humanoid = myChar:WaitForChild("Humanoid")
local Sprintplay = LocalPlayer.Character.Humanoid:LoadAnimation(Sprint)
Sprintplay.Priority = Enum.AnimationPriority.Movement
if humanoid.WalkSpeed == 30 then
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Running then
print("running")
Sprintplay:Play()
end
end)
end
I’ve also tried this
wait(2)
local LocalPlayer = game.Players.LocalPlayer
local Sprint = game.Workspace.Sprint
local Idle = game.Workspace.Idle
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local myChar = game.Players.LocalPlayer.Character or game.Player.LocalPlayer.CharacterAdded:wait()
local humanoid = myChar:WaitForChild("Humanoid")
local Sprintplay = LocalPlayer.Character.Humanoid:LoadAnimation(Sprint)
Sprintplay.Priority = Enum.AnimationPriority.Movement
local Idleplay = LocalPlayer.Character.Humanoid:LoadAnimation(Idle)
if humanoid.WalkSpeed == 30 then
local MV = LocalPlayer.Character.Humanoid.MoveDirection
if LocalPlayer.Character.Humanoid.MoveDirection == Vector3.new(0,0,0) then
Sprintplay:Stop()
Idleplay:Play()
end
if LocalPlayer.Character.Humanoid.MoveDirection ~= Vector3.new(0,0,0) then
if Sprintplay.IsPlaying ~= true then
Idleplay:Stop()
Sprintplay:Play()
end
end
LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Wait()
end