local sitAnim = 18201895983
local seat = script.Parent
local playingAnim
local player = game:GetService("Players"):FindFirstChildOfClass("Player")
local newAnim = Instance.new('Animation')
newAnim.AnimationId = 'rbxassetid://'..sitAnim
seat:GetPropertyChangedSignal("Occupant"):Connect(function(Occupant)
local Player = game.Players:GetPlayerFromCharacter(Occupant.Parent)
local Character = Occupant.Parent
local rightHand = Character.RightHand
if Occupant and Occupant:IsA("Humanoid") and not playingAnim then
playingAnim = Occupant:LoadAnimation(newAnim)
playingAnim:Play()
elseif Occupant and Occupant:IsA("Humanoid") and playingAnim then
local model = rightHand:WaitForChild("BasicBenchPressWeights", 5)
local motor6D = rightHand:WaitForChild("BenchpressMotor6D", 5)
model:Destroy()
motor6D:Destroy()
playingAnim:Stop()
playingAnim = nil
end
end)
before the script.parent line (adjust values based on how long the thing takes to load. if the seat is far from spawn, probably wait longer just to be safe)
local sitAnim = 18201895983
local seat = script.Parent
local playingAnim
local player = game:GetService("Players"):FindFirstChildOfClass("Player")
local newAnim = Instance.new('Animation')
newAnim.AnimationId = 'rbxassetid://'..sitAnim
seat:GetPropertyChangedSignal("Occupant"):Connect(function(Occupant)
if not seat.Occupant then return end
local Player = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent)
local Character = Occupant.Parent
local rightHand = Character.RightHand
if Occupant and Occupant:IsA("Humanoid") and not playingAnim then
playingAnim = Occupant:LoadAnimation(newAnim)
playingAnim:Play()
elseif Occupant and Occupant:IsA("Humanoid") and playingAnim then
local model = rightHand:WaitForChild("BasicBenchPressWeights", 5)
local motor6D = rightHand:WaitForChild("BenchpressMotor6D", 5)
model:Destroy()
motor6D:Destroy()
playingAnim:Stop()
playingAnim = nil
end
end)
You have to replace Occupant with seat.Occupant or create a variable for it
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local Occupant = seat.Occupant
if not Occupant then return end
local Player = game.Players:GetPlayerFromCharacter(Occupant.Parent)
local Character = Occupant.Parent
local rightHand = Character.RightHand
if Occupant and Occupant:IsA("Humanoid") and not playingAnim then
playingAnim = Occupant:LoadAnimation(newAnim)
playingAnim:Play()
elseif Occupant and Occupant:IsA("Humanoid") and playingAnim then
local model = rightHand:WaitForChild("BasicBenchPressWeights", 5)
local motor6D = rightHand:WaitForChild("BenchpressMotor6D", 5)
model:Destroy()
motor6D:Destroy()
playingAnim:Stop()
playingAnim = nil
end
end)