Animation Help: Working in preview but not in-game

What do you want to achieve?
Hey, I’m trying to achieve a animation of someone sitting. They click the proximety point, it teleports them to a certain point, (where the rig is in roblox studio), and then runs the animation. When I made the animation, it worked perfectly, but in-game, it doesn’t work. I also tried to add something where they user STAYS sitting, but for some reason I ran into trouble with it.

  1. What is the issue? Include screenshots / videos if possible!
    The issue is that in-game it does not work.
    (in animation editor)
    8e69bc394002644e661bd6cc23d9515d
    (in-game)
    cad2d956d9b2b9c6eff51cb8fd2a3f5d
Script that I have currently (Clicks on proximety point, teleports them to a point, and runs the animation
local part = script.Parent
local proximityPrompt = part:FindFirstChildOfClass("ProximityPrompt")

local teleportPosition = Vector3.new(174.152, 21.443, 498.463)

local animationId = 'rbxassetid://18364464705'

local animation = Instance.new("Animation")
animation.AnimationId = animationId


local function playAnimation(player)

	local character = player.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			local animator = humanoid:FindFirstChildOfClass("Animator")
			if not animator then
				animator = Instance.new("Animator")
				animator.Parent = humanoid
			end

			local animationTrack = animator:LoadAnimation(animation)
			animationTrack:Play()
		end
	end
end

local function teleportPlayer(player)
	local character = player.Character
	if character then
		local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
		if humanoidRootPart then
			humanoidRootPart.CFrame = CFrame.new(teleportPosition)
		end
	end
end

proximityPrompt.Triggered:Connect(function(player)
	teleportPlayer(player)
	playAnimation(player)
end)

What solutions have you tried so far?
The only solution I thought to maybe fix it was to allow the user to not collide (phase) through the chair as I thought it would be an issue with that, but nope. Any help in advance is appreciated!

What is the animation priority?

1 Like

You mean in relation to other animations? This is the only animation I have in-game right now, so highest I guess? I did not specifically outline that in the script.

image
in the animation editor, you can change the animation priority. this controls that movements get played when. It’s Core by default, try changing it to action.

I believe the priorities are listed in order from least to greatest. It looks like your movement is interfering with your sitting. If you made the animation action, it would take priority over the movement.

Oh wow, it worked, thank you so much!! I feel so dumb lol.

Do you know how I would achieve a way for the user to stay anchored/sitting? No worries if not. Thank you so much for the help!!

you could try using a seat

image

thank u for the help! have a great day

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.