As far as i know:
In the end: - When i start an animation, the number of progectiles it casts is somehow multiplied by the times i've casten before, but im not 100% this what i describled is causing it.
How do I fix that? How do I destroy the animation instead of just calling :Stop()? Or is there any other mechanic to make the old onimations be ignored?
local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character if not character then character = game.Players.LocalPlayer.CharacterAdded:Wait() end local humanoid = character:WaitForChild("Humanoid") local mouse = player:GetMouse() local RemoteEvent = game.ReplicatedStorage.RemoteEvent local SkyBlastControl = false local StormCast = workspace.StormCast -- mudar local StormCastTrack = humanoid:LoadAnimation(StormCast) mouse.Button1Down:Connect(function() SkyBlastControl = true local hit = mouse.Hit StormCastTrack:Play() StormCastTrack:GetMarkerReachedSignal("SkyBlast"):Connect(function() if SkyBlastControl == true then print("SkyBlastCasten") end end) end) mouse.Button1Up:Connect(function() SkyBlastControl = false StormCastTrack:Stop() print("unclicked") for _, track in ipairs(humanoid:GetPlayingAnimationTracks()) do if track == StormCastTrack then track:Stop() break end end end)
Here is the output:
Necro_las applied edits to script StormScript - SkyBlastCasten - unclicked - SkyBlastCasten (x2) - unclicked - SkyBlastCasten (x3) - unclicked - SkyBlastCasten (x4) - unclicked (x5) - SkyBlastCasten (x9) - unclicked