Script:
local Players = game:GetService("Players")
local Seat = script.Parent
Players.PlayerAdded:Connect(function(player) --Checks if player joined
player.CharacterAdded:Connect(function(char) --Finds players character
local humanoid = char:WaitForChild("Humanoid")
local track = char:WaitForChild("Humanoid"):LoadAnimation("rbxassetid://5802182659")
wait(2)
Seat:Sit(humanoid) --Makes the player sits in the chair
humanoid.JumpPower = 0 --Doesn't let player exit chair
track:Play()
if script.Parent.Occupant == nil then --Makes sure the player is sat in the chair
print("Not Occupied")
Seat:Sit(humanoid)
humanoid.JumpPower = 0
print(humanoid.Parent.Name.." has occupied the seat.") --Prints who is in the chair
end
end)
end)
it's a server script and gives me the error unable to cast value to object

1 comment
Which line?