I am making a little game where it starts off dramatic and then it gets funny and stuff and right now I am trying to make a dramatic intro cutscene. So, what I need help with is setting it up.
Now, I’ve already got the animation which I will upload but I’m not sure how to set it up so then the player in the chair and sees this play when they join in the chair and can’t get out till the animation/cutscene is over with.
Also, how can I make sure when other players join that they don’t spawn in the same chair?
To make a Humanoid Sit, you could put all the chairs in a Folder and then use :Sit() on the seat to force them to sit. Adding onto this, you’ll need to have different cutscenes depending on what seat the player is in. You can achieve this by potentially having parts in the chair model that tell the camera where to go, and then basing that off of where the player is sitting. Anyways, in terms of getting the player to sit in a seat that isn’t taken, try this. Keep in mind this isn’t exactly efficent so I’d recommend just using this as a baseline and working off of it. Also, this is going to happen whenever character is added because we have the CharacterAdded event. If you don’t want that, simply reference the character with plr.Character instead.
local p = workspace.a -- or whatever the folder is called
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
repeat task.wait() until char:FindFirstChild("Humanoid") -- because this code runs fast we need this line to confirm that there is actaully a humanoid
for _, v in pairs(p:GetChildren()) do
if v.Seat.Occupant == nil then -- confirm no one is sitting in the chair
v.Seat:Sit(plr.Character.Humanoid)
break
end
end
end)
end)
In terms of making it so the player can’t jump until the cutscene is over, you can set the players JumpPower or JumpHeight to 0, forcing them to not be able to jump. After the cutscene is over, you could set the JumpPower or JumpHeight back to the default.