You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to pause an animation at the very last frame before it ends for a specified amount of time.
- What is the issue? Include screenshots / videos if possible!
The animation will pause and stop correctly on the server but will not stop on the client.
Example: (Server on left client on right)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked for solution but found none.
I should mention that any coding I do with this method has the same error when it includes the following:
self["CurrentAnimation"].Length*.99
and
task.delay(self["CurrentAnimation"].Length*.99,function()
-- anim wait stuff here
end)
Here is the code I am using:
local StunTime = Settings["StunTime"]
self["CurrentAnimation"].TimePosition = 0
RunAnimation(self["CurrentAnimation"],.1,1) --anim , fade in, speed
StopMovement()
local AnimationLength = self["CurrentAnimation"].Length*.99
local Modify = false
if AnimationLength / self["CurrentAnimation"].Speed > StunTime then
Modify = true
repeat
local speed = self["CurrentAnimation"].Speed + 0.01
ChangeSpeed(speed)
task.wait()
until StunTime < (AnimationLength / self["CurrentAnimation"].Speed)
end
if Modify == true then
task.delay(AnimationLength / self["CurrentAnimation"].Speed,function()
PauseAnimation()
end)
else
task.delay(AnimationLength,function()
PauseAnimation()
end)
end
task.spawn(function()
repeat task.wait()
local function DoThing()
if tick() - LastStun > StunTime then
StopAnimation(0)
WakeUp()
return true
end
end
until DoThing() == true
end)