I am trying to make a script that will force the player to be seated during a cutscene, but the script I am using does not work?
-- Roblox services
local Workspace = game:GetService("Workspace")
-- Variables
local seat = script.Parent
local Classroom3 = seat.Parent.Parent
local seatOccupant = seat.Occupant
local CutscenePlayed = Classroom3:WaitForChild("CutscenePlayed")
local CutsceneScript = Classroom3:WaitForChild("cutsceneScript")
print("Test 1")
local function startCutscene()
print("Test 2")
if CutscenePlayed.Value == false then
CutsceneScript.Disabled = false
while true do
wait(0.1)
seatOccupant.Sit = true
end
end
seat:GetPropertyChangedSignal("Occupant"):Connect(startCutscene)
When I run this code, I get this error message: Attempt to index nil with 'Sit'
I don't really understand the error message. I know what nil is, but indexing?
All help will be appreciated greatly!
EDIT: I tried to print seatOccupant, but it printed nil.

1 comment
Put in a server script: Humanoid:Sit(insert seat here)