I have this down. it doesent work in roblox, but works in roblox studio. can someone please help me?
local animation = script:WaitForChild('Animation') local humanoid = script.Parent:WaitForChild('Humanoid') local dance = humanoid:LoadAnimation(animation) wait(10) dance:Play() while true do wait(dance.Length) script.Parent.LeftFoot.Sound:Play() end
it is a script that only works in roblox studio it seems. when i test it in roblox, it doesnt work. how could i fix this? here. i will explain the properties. the rig this animation is in is an r15, and Dance is the animation, shows at local dance =.. yea. I made the animation, and also, there is a sound that is in the left foot of the rig, i want that to play once the animation ends. that is why it says wait(Dance.Legnth). and, thats almost it. i think the problem may be because the script is outdated, but im not sure. ive tried multiple ways, but all of them didnt work... this one actually plays the animation and noise in roblox studio, but not roblox.
Basically, that won't work unless you channel the local player on the client... So ye here's the code:
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local animation = script.Parent:WaitForChild("Animation") local humanoid = char:WaitForChild("Humanoid") local Track = humanoid.Animator:LoadAnimation(animation) wait(10) Track:Play() while true do waitcount = --how long your animation is wait(waitcount) char:WaitForChild("LeftFoot").Sound:Play() end
Also, client animation is replicated to the server automatically. So anything animation that is casted on the client is on the server, so everyone else can see it.