Custom sit animation not working

  1. What do you want to achieve?
    A seating animation that works

  2. What is the issue?
    Seat animation not working
    image

  3. What solutions have you tried so far?
    None

Basically there are multiple seats. When a player joins they’re assigned to a seat and a seating animation should play (but it doesnt at the moment)

Also, this would probably be a good thing to add, I do see the normal sit animation (not mine) working at the start but then it stops.

local Players = game:GetService("Players")
local Animations = game:GetService("ReplicatedStorage").Animations

local Seats = workspace.Seats
local Taken = {
	[1] = false,
	[2] = false,
	[3] = false,
	[4] = false,
	[5] = false,
	[6] = false,
}
local Animation1 = Animations:WaitForChild("Sit")
local Animation2 = Animations:WaitForChild("Sit2")

Players.PlayerAdded:Connect(function(Target)
	Target.CharacterAdded:Once(function(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		
		for SeatNumber = 1, 6 do
			local isTaken = Taken[SeatNumber]
			if not isTaken then
				local Seat = Seats[SeatNumber]
				Character:SetPrimaryPartCFrame(Seat.CFrame)
				Seat:Sit(Humanoid)
				
				repeat task.wait(1) until Target:HasAppearanceLoaded()
				
				
				local Animation
				
				if SeatNumber == 6 then
					local Animation = Humanoid:LoadAnimation(Animation2)
					Animation:Play()
					Taken[SeatNumber] = Target
					break
				else
					local Animation = Humanoid:LoadAnimation(Animation1)
					Animation:Play()
					Taken[SeatNumber] = Target
					break
				end
			end
		end
	end)
end)

Players.PlayerRemoving:Connect(function(Target)
	for SeatNumber, isTaken in Taken do
		if isTaken == Target then
			Taken[SeatNumber] = false
		end
	end
end)

Any help appreciated.

1 Like

Is there any errors within the console? Something about the script, or maybe the animator’s animation limit?

If the animation is not working in Roblox studio, maybe playtest it out of Roblox studio. This bug happens to many people. Also, before asking anyone for help, try figuring it out yourself, as it’s a good way to learn.

I did, and I tried figuring out myself before. Probably should’ve included that

No

thirtycharlim

I think I got it. So, you used Humanoid:LoadAnimation() but, to my knowlege that is deprecated. Instead, get the animator inside the humanoid by going

local animator = humanoid:WaitForChild(“Animator”)

Then you just go

animator:LoadAnimation(–Put your animation here.AnimationId)

Again, I might be wrong, but if you can try this.

Managed to fix, something in another script was disabling animations.