local seat = script.Parent
local player
seat.ChildRemoved:connect(function(player)
seat.ChildRemoved:connect(function(child)
local TP = script.Parent.Parent.Body.tpout
player.Character.HumanoidRootPart.CFrame = CFrame.new(TP.Position)
end)
end)
What it looks like:
( The grey brick is where the player is supposed to TP. )
Are you sure it’s not just getting stuck in it? It’s hard to see where you’re actually getting tp’d to because of the clip but it looks like you’re stuck in something.
Try setting the TP part to CanCollide = false and trying again.
The TP part is false, and has been false since the day it was inserted. It is the code, not the TP part. You are only getting stuck because the top of the car is cancollide on, this is supposed to TP the player out of the car, there are no errors.
ChildRemoved wasn’t the issue. I fixed the code. I just added a setup for all of them, and some more.
new code:
local seat = script.Parent
local player
seat.ChildAdded:connect(function(child)
if child.Name == "SeatWeld" then
player = child.Part1.Parent
local plr = child.Part1.Parent:GetChildren()
end
end)
seat.ChildRemoved:connect(function(child)
if child.Name == "SeatWeld" then
local plar = player:GetChildren()
for i=1,#plar do
local TP = script.Parent.Parent.Body.tpout
wait(.5)
player.HumanoidRootPart.CFrame = CFrame.new(TP.Position)
wait(.1)
player.HumanoidRootPart.CFrame = CFrame.new(player.HumanoidRootPart)
wait(.1)
end
end
end)