Hello, I am making with friends SCP game but for some reason animations are bit buggy
here is a script:
--anims
local anims = game.ReplicatedStorage.Animations.S096
local event = game.ReplicatedStorage.scp096event
local rageEvent = false
local InRage = false
local sg
event.OnServerEvent:Connect(function(plr1,id,plrPos,sgpos)
sg = workspace.SCPs:FindFirstChild("SCP096")
if plr1 == nil then return end
local hum = sg:WaitForChild("Humanoid")
local SadIdle = hum:LoadAnimation(anims.IdleSad)
local SadWalk = hum:LoadAnimation(anims.WalkSad)
local SadToRage = hum:LoadAnimation(anims.SadToRage)
local RageRun = hum:LoadAnimation(anims.RageRun)
local RageIdle = hum:LoadAnimation(anims.RageIdle)
if id == 1 then
hum.WalkSpeed = 7
hum.Running:Connect(function(speed)
if speed > 0 then
if not SadWalk.IsPlaying then
if InRage == false then
SadIdle:Stop()
SadWalk:Play()
else
SadWalk:Stop()
SadIdle:Stop()
RageIdle:Play()
RageRun:Play()
end
end
else
if not SadIdle.IsPlaying then
if InRage == false then
SadWalk:Stop()
SadIdle:Play()
else
SadWalk:Stop()
SadIdle:Stop()
RageRun:Stop()
RageIdle:Play()
end
end
end
end)
elseif id == 2 then
if not plrPos then warn("Error, Player not found") return end
if not sgpos then warn("Error, SCP096 not found") return end
if rageEvent == true then return end
print("ráge")
rageEvent = true
hum.WalkSpeed = 0
SadIdle:Stop()
SadWalk:Stop()
SadToRage:Play()
wait(5)
hum.WalkSpeed = 30
InRage = true
end
end)
the problem is that for some reason not always it will turn on first idle Animation
and sometimes it takes some time until the script proceed the animation
how to fix it?
video: