Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Whats not working with this script? Nothing is coming out on the output.

local human = game.Players.LocalPlayer.Character.Humanoid
local hold = human:LoadAnimation(script.Parent.hold)
local tool = script.Parent

tool.Equipped:connect(function()
	hold:Play()
end)
tool.Unequipped:connect(function()
	hold:Stop()
end)

This is all located in a localscript. When I Play solo, the animation does not play.

2 comments

0

I think it is because animations have to be in the workspace. Just try that and modify your code to fit the location change and try it.

0

I have another animation that's working fine in the tool..

2 answers

✓ Accepted answer

The game probably hasn't loaded the humanoid yet. This works with local scripts, try:

repeat wait() until game.Players.LocalPlayer
human = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

the game will wait until the player has loaded and then also wait for the humanoid to load before proceeding.

Well Jaffer, since no one wants to answer your question, I'll answer it for you. The thing with finding locating the humanoid through localplayer is that the character loads some time after the localplayer. So, this can simply be fixed by adding a wait() of one or 2 seconds at the beginning.

3 comments

0

Wow Jaffer! Thanks! This actually worked!

0

HAHAHA

0

LOL

This discussion is preserved as it was. New answers, comments, and votes are closed.