So basically I’m trying to make a animation where the character sits down than lays down after it sits but right after that how can I make it where the player stays at the lay down position until they start walking again (aka using the w,a,s,d keys I guess)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local mouse = player:GetMouse()
local timePosition = 3
local percentagePosition = 99
local animation = Instance.new("Animation")
animation.Name = "HandsUp"
animation.AnimationId = "rbxassetid://3336575859"
track = character:WaitForChild("Humanoid"):LoadAnimation(animation)
mouse.KeyDown:Connect(function(key)
if key == "x" then
track:Play()
end
end)
You should use GetMarkerReachedSignal and Set Animation events in the animation editor. What I do is I set one an event named End right as I want it to stop toward the end of the animation. Then when it fires I set the speed of the animationtrack to 0 which stops and holds the animation in that position. Then if you wanted to stop it all the way just use animTrack:Stop() later when the player moves or presses wsad. You can also set position of the animation track using something like animTrack.TimePosition = 1.48
Below is code to catch the Event named End and set speed to 0
local animTrack = AnimationController:LoadAnimation(Animation)
animTrack:GetMarkerReachedSignal("End"):Connect(function()
animTrack:AdjustSpeed(0)
end)
animTrack:Play()
This is how you add them in editor by Right clicking in that area