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) --
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)
script.Parent.PlaySound.OnServerEvent:Connect(function(plr, sound) sound:Play() end) -- script inside tool, remote event inside tool
:Connect()
as :connect()
is deprecated and should not be used in new work.