script.Parent.ClickDetector.MouseClick:Connect(function()
game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
end)
There is a click detector and an animation with an ID inside the part and also the local script.
script.Parent.ClickDetector.MouseClick:Connect(function()
game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
end)
There is a click detector and an animation with an ID inside the part and also the local script.
Since LocalScripts must have a connection to a Client you can't use a LocalScript in Workspace. Change the script to a Server Script (normal Script) and write the following code;
script.Parent.ClickDetector.MouseClick:Connect(function(player)
player.Character.Humanoid:LoadAnimation(script.Parent.Animation)
end)
When a ClickDetector is clicked. It fires the Event and sends the player who clicked it as an argument. So when we recieve the Event we give the argument a name, in this case player. Then we use our argument, player, and gets the Character as you did before.
Thank you very much, It did not work at first but I think we both forgot :Play() xD
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
LocalScripts doesn't work in Workspace
Use a Server Script instead