Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can i make it so the player teleports to 0,50,0?

Asked by
7_Fig 0
4 years ago
workspace.Seat:GetPropertyChangedSignal("Occupant"):Connect(function(occupied)
    wait(0.5)
     if not workspace.Seat.Occupant then
        workspace.Baseplate.Transparency=1
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

You need to make a variable to store the Player that was using the Seat before they got up. When they get off the seat, we can use their variable to move them to the respective location. It would look something like this.

workspace.Seat:GetPropertyChangedSignal("Occupant"):Connect(function(occupied)
    local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent) -- We are getting the Player that is currently using the seat
    local Character = Player.Character -- We are getting their Character
    local HumanoidRootPart = Character.HumanoidRootPart -- The HumanoidRootPart is what we use to teleport the Player.
    wait(0.5)
    if not workspace.Seat.Occupant then
        Player.Character.HumanoidRootPart.CFrame = CFrame.new(0,50,0) -- We are setting the HumanoidRootPart's CFrame to (0,50,0).
    end
end)
Ad

Answer this question