How to force player to be seated?
Asked by
5 years ago Edited 5 years ago
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?
02 | local Workspace = game:GetService( "Workspace" ) |
05 | local seat = script.Parent |
06 | local Classroom 3 = seat.Parent.Parent |
07 | local seatOccupant = seat.Occupant |
08 | local CutscenePlayed = Classroom 3 :WaitForChild( "CutscenePlayed" ) |
09 | local CutsceneScript = Classroom 3 :WaitForChild( "cutsceneScript" ) |
13 | local function startCutscene() |
17 | if CutscenePlayed.Value = = false then |
19 | CutsceneScript.Disabled = false |
25 | seatOccupant.Sit = true |
31 | 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.