Struggling with teleporting a model out of another part to a different location

Do you need to detect when the player is teleported for another function in game

Edit: in other words, when the player isnt OOB anymore

Not for another function, but instead the same one.

If a player drives into an OOB region, teleports away from it, and the drives back into the same exact OOB region, it won’t trigger until they manually drive out of it and back in again.

Also can you please send the entire, or at least the whole part of the script that has something to do with respawning as we are missing part of the script

also setting the kart.Parent.PrimaryPart to nil seems unnecessary and it wastes resources because you keep setting it and unsetting it

The only other part of the script that has to do with respawning is in the same function:

	if respawnCheckpoint then
		respawnCFrame = box.CFrame

Having the PrimaryPart set to anything but nil causes the game to behave strangely, so I only set it when I absolutely have to.

This sounds as though you are forgetting to set a value to false after telelorting them back, resulting in driving into it again not registering another teleport.

In the script you provided, you are never setting outofbounds to false again

As a side note, you Should Not use SetPrimaryPartCFrame As it is deprecated.. PivotTo() Was the replacement for this, and as stated by roblox documentations:

" This function has been superseded by PVInstance:PivotTo() which acts as a more performant replacement and does not change your code’s behavior. Use PVInstance:PivotTo() for new work and migrate your existing Model:SetPrimaryPartCFrame() calls when convenient."

Having the primary part set to nil doesn’t make the game behave strangely. You can also try to kart.Parent:SetNetworkOwner(nil) which might stop strange behavior when the primary part is set.

Oh damn, i have a lot of stuff using primart part cframes uh oh

1 Like

I know. It was a mistake I was caught in too as well, because no one would tell me

  • I just want to inform so you don’t do the same mistake I did of relying on SetPrimaryPartCFrame

Still, setting the networkowner to nil makes it so the server is responsible for the collisions and not the closest player to it

I suppose I should’ve provided a video of what’s actually happening…


Here’s the issue, notice how when the kart enters the red box the second time, nothing happens. What I’m trying to do it move the kart out of the box in a way that allows the kart to register that it has stopped touching the object.

1 Like

Like I said before, try doing kart.Parent:SetNetworkOwner(nil) towards the top of your whole script, so the server does the collisions and “owns” the kart.

Why not just set outofbounds to false when teleporting

that won’t change anything because outofbounds is a local variable

Could make it global and make it nil as a default value

Tried that, unfortunately it causes the kart to not detect any collisions at all

Is the script global or local?

It’s a global script, I rarely ever use local scripts outside of GUIs and such.