Hello! So, I’m getting this error for syncing sounds to Fe Gun Kit, but I keep on getting this error, could anyone help?
Hello! So, I’m getting this error for syncing sounds to Fe Gun Kit, but I keep on getting this error, could anyone help?
Can you put your code in a code block instead of a screenshot
It appears that ReloadAnim is nil.
Maybe you defined ReadloadAnim In a different block of code that has already ended. Maybe it would work if you make the Variable for Reloadanim without the local and just define it. However it is hard to tell because you didn’t share the whole script so that is just a guess.
Okay, so first of all code screen shot? Seriously? I am not retyping all of it, forget it.
The problem is that, after you check whether animation exists, instead of making connections only in such case, you attempt to make connection regardless. Correct code is this:
if Animations.ReloadAnim then
Animations.RelaodAnim:Play(nil, nil, Module.ReloadAnimationSpeed)
--end remove that 'end'
ReloadAnim:GetMarkerReachedSignal("MagOut"):Connect(function()
Handle.MagOut:Play()
end)
-- here are rest of the connections that I do not want to re-type
--ReloadAnim:Get....... and so on
end -- move the end here after the connections.
Do this for all 3 Animation checks. Finally, making new connection, every time an animation is played, will cause you to have multiple stacked on each other. That will probably work, but may cause lag in the long run or some undesirable effects.
Idealy to solve this, you should move your connection to the part of the code, where you load the animations (connect only once). Alternatively, as a quick fix, you can use :Once()
instead of :Connect()
. This way connection will automatically disconnect after first invoke.
ReloadAnim:GetMarkerReachedSignal("MagOut"):Once(function()