i made animations like wald run etc. but how to i let them work a default for my game?
COMMUNITY QUESTION
How can i make an animation play like its a default?
1 answer
I really do not know what you mean by "wald run" sorry. However, I understood that you made an animation and want it to play when player is running all the time I assume. It would be preferable for you to also create an idle animation (when player is not moving) but it is not neccessary. So you should create a script in ServerScriptService and write the following:
game.Players.PlayerAdded:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
hum.Running:Connect(function(speed)
local anim = Instance.new("Animation")
if speed > 0 then
anim.AnimationId = "rbxassetid://12345" -- 12345 must be changed to your Running Animation Id
local animTrack = hum:LoadAnimation(anim)
animTrack:Play()
elseif speed <= 0 then
anim.AnimationId = "rbxassetid://12345" -- 12345 must be changed to Idle Animation Id
local animTrack = hum:LoadAnimation(anim)
animTrack:Play()
end
end)
end)
In this we have used the Running Event http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Running and the speed variable stores the speed of the player at so you can monitor it for your purposes. The elseif speed <= 0 doesn't have to be included but is recommended so your game looks better
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
thx thx thx
ok can you please say that this answer is accepted