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

LocalScript not working?

Hello, everyone!

I have just tried making an animation script for a tool. The sound plays, but the animation doesn't. Can someone please help? Thanks! :) PS. It is a local script, and the animation is made by Jazzyx3 (not on team create)

script.Parent.Equipped:connect(function(m)
	m.Button1Down:connect(function()
		local ani = Instance.new("Animation")
		ani.AnimationId = "http://www.roblox.com/Asset?ID=334721663"
		local anitrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(ani)
		anitrack:Play()
		wait(.05)
		script.Parent.Handle.Sound:Play()
	end)
end)
--

8 comments

0

http://wiki.roblox.com/index.php?title=API:Class/AnimationTrack/AdjustWeight Your animation's weight is lower than the current animations running on the character. Probably

0

is the animation made by you? is the game on team create?

0

is it a localscript?

0

did you set priority to action or movement?

0

It's a local script, and the animation is made by Jazzyx3 (not on team create)

0

you can't use other people's animations, you have to make your own

0

roblox doesn't allow it

0

Oh, I didn't know.

1 answer

✓ Accepted answer

###You will need a RemoteEvent.

script.Parent.Equipped:Connect(function(mouse)
    mouse.Button1Down:Connect(function()
        local ani = Instance.new("Animation")
        ani.AnimationId = "rbxassetid://334721663"
        local anitrack = game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(ani)
        anitrack:Play()
        wait(.05)
        script.Parent.PlaySound:FireServer(script.Parent.Handle.Sound)
    end)
end)

###Server code:

script.Parent.PlaySound.OnServerEvent:Connect(function(plr, sound)	sound:Play()
end)
-- script inside tool, remote event inside tool

###As others have said, animations must be self-made, but this will play sound.

###On a side note, switch to :Connect()as :connect() is deprecated and should not be used in new work.

1 comment

0

Thanks for telling me this! Altough, I already found a solution. But, thanks!! :D

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