When a player jumps out of a chosen seat. They get teleported to a selected location

  1. What are you trying to achieve?
  • When a player jumps out of a seat in my ride, they should be teleported to the entrance of the ride.
  1. What is the issue?
  • When I test my script the player does not get telported to the ride entrance.
  1. What solutions have you tried so far?
  • I’ve tried
This script
place = CFrame.new(530.359, 194.356, -316.093)
while true do
if Seat.Occupied = false
humanoid.Torso.CFrame = place 

  • However, every time I try to improve on it and test it it doesn’t teleport the player as expected.
while true do
if Seat.Occupied = false
humanoid.Torso.CFrame = place 

This might be the error. Try this instead!

    while wait() do
    if Seat.Occupied == false then
    humanoid.Torso.CFrame = place

hope this helps! :smiley:

What you could do is listen to when the seat becomes occupied, store the player in a variable, then when the seat becomes empty again, teleport the player to the ride entrance.

local RideEntrance = CFrame.new() -- Replace this with the CFrame of the ride entrance
local Seat = ride.Seat -- replace this with the seat of the ride
local LastPlayer = nil -- This is the last player that sat on the seat

-- Connect a function to the PropertyChangedSignal - this means whenever the "Occupant" property of the seat is changed, this function will run.
    local humanoid = Seat.Occupant -- get the player sitting on the seat
    -- Check if there is someone sitting on the seat or if someone is leaving the seat
    if humanoid then
        print("Player sat on the seat")
        LastPlayer = humanoid.Parent -- set the last player to this player
        print("Player left the seat")
        -- We know a player just left the seat, and we know the player is stored in LastPlayer

Does this go in the seat or in SSS?

1 Like

Up to you, it makes no difference. Just make sure that the Seat vairable points to the Seat object and the RideEntrance is the CFrame where you want the players to be teleported to.

This is what I put, but in testing when I went in the seat and jumped up it didn’t teleport me to the coordinates.

It cannot be in a local script, because you cannot teleport the player from the client as far as I know. It needs to be in a Script, not a LocalScript

1 Like

I changed it to a script, and it still doesn’t teleport the person.

Does anything print to the console?

It prints that I’ve sat down and got up. image

Try making a part, getting it’s CFrame and using the parts CFrame to teleport the player out of the ride once they jump out.

Just tried that and It didn’t work.

being you should check if the seat.Occupent is a humanoid because you are just checking if it exists

if humanoid and humanoid:IsA("Humanoid") then
   --your code

Try this:

local Seat = script.Parent
local place = CFrame.new(530.359, 194.356, -316.093)
local humanoid = nil

function sat()
    if humanoid == nil then
         humanoid = Seat.Occupant
    humanoid.Parent.UpperTorso.CFrame = place
    humanoid = nil


Every time the occupant property changes, it fires the function.

Please excuse any spelling mistakes, I’m on mobile.

1 Like

This worked! Thank you. :grin:

1 Like