localscript
local Mouse = plr:GetMouse() --removed checks to keep this short local animation = script.Tag local animTrack = hum:LoadAnimation(animation) animTrack.Looped=true Mouse.Button1Down:connect(function() animTrack:Play() script.AnimationHandler:FireServer(true) --fires remoteevvent end) Mouse.Button1Up:connect(function() animTrack:Stop() script.AnimationHandler:FireServer(false) --fires remoteevvent end)
remoteevent
repeat wait() until script.Parent.Parent.Parent.Parent.Character~=nil local hum = script.Parent.Parent.Parent.Parent.Character:WaitForChild("Humanoid") local animTrack = hum:LoadAnimation(script.Parent.Parent.Tag) animTrack.Looped=true script.Parent.OnServerEvent:connect(function(plr,playing) if playing==true then animTrack:Play() else animTrack:Stop() end end)
Mouse.Button1Up
fires when you release your mouse button. Maybe it only replicates once because you release your mouse button before the animation would repeat?