Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

AnimationEvents beeing called as much times as the animation were ever played. Help?

Asked by
Necro_las 412 Moderation Voter
5 years ago
Edited 5 years ago

As far as i know:

  • Im using Animation Event to cast a spell at a certain point of the animation,
  • but everytime i call :Play() on the loaded track, it looks like it creates another extra parallel track,
  • when i call :Stop() the track is actually still there in the background and stopped.
  • Calling :Play() again creates a new one and restarts ALL of them.
  • The event (for firing a spell) is called as much times as there are animations ever played in the "background" when the point of MarkedSignal of the one showing animation is reached.

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?

01local Players = game:GetService("Players")
02local player = Players.LocalPlayer
03local character = player.Character
04if not character then
05    character = game.Players.LocalPlayer.CharacterAdded:Wait()
06end
07local humanoid = character:WaitForChild("Humanoid")
08local mouse = player:GetMouse()
09local RemoteEvent = game.ReplicatedStorage.RemoteEvent
10local SkyBlastControl = false
11    local StormCast = workspace.StormCast -- mudar
12    local StormCastTrack = humanoid:LoadAnimation(StormCast)
13 
14mouse.Button1Down:Connect(function()
15    SkyBlastControl = true
View all 35 lines...

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

0
Can we see the code so we can understand what is happening better? AlmostADemon 50 — 5y
0
There it is Necro_las 412 — 5y
0
Just made some edits that i realized now Necro_las 412 — 5y

1 answer

Log in to vote
0
Answered by
Necro_las 412 Moderation Voter
5 years ago

Solved.

":GetMarkerReachedSignal("SkyBlast"):Connect" creates a new connection with anim so it was duplicating the events, not the animations.

0
yay glad you solved it royaltoe 5144 — 5y
Ad

Answer this question