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)