Table hiding animations bugging out

Im trying to make hiding animations for my game. The table script and hiding script work like a charm but its just with the animation’s that I find weird

Video demonstrating the bug: https://youtu.be/I_NrG3h-RQg

Exit hiding script:

local ts = game:GetService("TweenService")
script.Parent.Triggered:Connect(function(plr)
	local idle = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Idle)
	local enter = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Enter)
	local exit = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Exit)
	print("triggered")
	script.Parent.Parent.Out:Play()
	idle:Stop()
	local tween = ts:Create(plr.Character.HumanoidRootPart,TweenInfo.new(0.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out),{CFrame = script.Parent.Parent.CFrame + Vector3.new(0,1,0)})tween:Play()
	wait(0.5)
	--plr.Character.HumanoidRootPart.CFrame = script.Parent.Parent.Parent.ExitCFRAME.CFrame -- i need to add parts
	script.Parent.Parent.Parent.IsPlayerInLocker.Value = 0
	--local tween2 = ts:Create(script.Parent.Parent,TweenInfo.new(0.5,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{CFrame = script.Parent.Parent.Parent.DoorClosed.CFrame})tween2:Play()
	plr.Character.HumanoidRootPart.Anchored = false
	plr.Character:SetAttribute("hiding",false)
	script.Parent.Enabled = false
	script.Parent.Parent.HidePrompt.Enabled = true
	exit:Play()
	
end)

Enter hiding script:

local ts = game:GetService("TweenService")
script.Parent.Triggered:Connect(function(plr)
	local idle = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Idle)
	local enter = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Enter)
	local exit = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Parent.Exit)
	print("triggered")
	plr.Character.HumanoidRootPart.Anchored = true
	script.Parent.Parent.In:Play()
	local tween = ts:Create(plr.Character.HumanoidRootPart,TweenInfo.new(0.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out),{CFrame = script.Parent.Parent.CFrame + Vector3.new(0,1,0)})tween:Play()
	wait(0.5)
	plr.Character:SetAttribute("hiding",true)
	script.Parent.Parent.Parent.IsPlayerInLocker.Value = 1
	script.Parent.Enabled = false
	script.Parent.Parent.ExitPrompt.Enabled = true
	enter:Play()
	wait(.18)
	idle:Play()
end)

Instead of waiting on the last line on entering, try putting enter.Ended:Wait()
This will make the script wait for the animation to end so it can continue to the other one

Same result, no errors either.

Can you check if the animation is actually there? Like crouching

image

1 Like

And in both scripts, i loaded it into the humanoid, so it should be in there.

1 Like

This is weird, why is humanoidrootpart anchored?

1 Like

This is to make sure the player doesn’t move while hiding, I tried it with Humanoid.WalkSpeed = 0 but its the same result, also I think i found the problem.
image
It wont print out that message I gave to the script, so its happening there.

My bad maybe put .Stopped instead of .Ended

Again, same result, no errors :confused:

Just in case, can you put a print when it plays?

Its not printing that out either so it has to be something with the animations playing or just the animations itself

Also, is idle looped? Forgot to tell you this

Yeah, its looped, and its animation priority is also set to Idle.

Really weird… is the script local?

No, its in a server script, both of them.

Well, im unsure about server animations, local animations works just fine

Im gonna try to import it in a local script then, the only problem is, other players might not see it.

They will be able to see it dw

Also, is the exiting script interfering with the other script?