Hello developers! How can i prevent wait between two animations? Video of the issue and the code will be below.
Code:
takeCameraEvent.OnServerEvent:Connect(function(plr)
if canTake.Value == true then
local char = model.Parent
print(char.Name)
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then
print("Processing animations and visuals.")
canTake.Value = false
local anim = hum:LoadAnimation(takeCamera)
local anim2 = hum:LoadAnimation(holdCamera)
local anim3 = hum:LoadAnimation(putCamera)
anim2.Looped = true
anim:Play()
inAnimation.Value = true
anim:GetMarkerReachedSignal("Take"):Wait()
belt.PrimaryPart.Transparency = 1
weld.Part0 = char.RightHand
beltWeld.Part0 = char.UpperTorso
local cf0 = CFrame.new(0,-model.PrimaryPart.Size.Y/2,0) * CFrame.Angles(math.rad(90),0,math.rad(180))
weld.C0 = cf0
anim.Ended:Wait()
anim2:Play()
inAnimation.Value = false
ready.Value = true
canTake.Value = true
putCameraEvent.OnServerEvent:Wait()
canTake.Value = false
ready.Value = false
anim3:Play()
anim2:Stop()
inAnimation.Value = true
anim3:GetMarkerReachedSignal("Put"):Wait()
belt.PrimaryPart.Transparency = 0
weld.Part0 = char.UpperTorso
local cf0 = CFrame.new(0,0,-char.UpperTorso.Size.Z) * CFrame.Angles(0,math.rad(180),0)
weld.C0 = cf0
anim3.Ended:Wait()
canTake.Value = true
else
warn("Couldn't find humanoid.")
end
else
warn("Can't take the camera.")
end
end)