-
What do you want to achieve?
A seating animation that works -
What is the issue?
Seat animation not working
-
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.