can you load the animations outside of the events? that way it will be more convinient
Yeah but the player wont be a variable so im gonna have to wrap everything in a game.Players.Playeradded:connect(function() script
thats why you use animations on local, but that works too
actually do chacracter.added, the server will start before the character joins
not this again
Current script btw:
local ts = game:GetService("TweenService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local idle = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Idle)
local enter = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Enter)
local exit = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Exit)
script.Parent.HidePrompt.Triggered:Connect(function()
print("triggered")
plr.Character.HumanoidRootPart.Anchored = true
script.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)
print("Tween completed!")
plr.Character:SetAttribute("hiding",true)
script.Parent.Parent.IsPlayerInLocker.Value = 1
script.Parent.HidePrompt.Enabled = false
script.Parent.ExitPrompt.Enabled = false
enter:Play()
print("Enter animation playing.")
enter.Ended:Wait()
print("Enter animation ended, idle should be playing now!")
idle:Play()
end)
script.Parent.ExitPrompt.Triggered:Connect(function()
print("triggered")
script.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.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.ExitPrompt.Enabled = false
script.Parent.HidePrompt.Enabled = true
exit:Play()
end)
end)
end)
hmm, try adding a wait before loading all 3 animations
and also i dont know why you have idlestop before wait0.5, it wont really look well
This worked, Thank you so much!
np man, sorry if i was slow lol
Also this worked to as well (makes it look better)
1 Like
Aannnnnnd theres another problem. ill post it as another topic though.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.