Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

workspace.Seat:GetPropertyChangedSignal("Occupant"):Connect(function(occupied)
    wait(0.5)
     if not workspace.Seat.Occupant then
        workspace.Baseplate.Transparency=1
    end
end)

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.