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

I tried what both of you have said, but again, what I’m trying to do is move the kart out of the OOB area while making sure that TouchEnded is triggered.

SetPrimaryPartCFrame gives the same result as before.

Is COL_BOUNDARY getting deleting from the parts?

Could try using a variable such as moved and check if its true, which it would be true from moving the kart, then run whatever you need as a workaround to touchended.

No parts are added or removed in the process, the kart is simply failing to register that it has stopped touching it when teleported.

Can try adding a function under the already existing function that can check if outofbounds is false, should only be triggered if the outofbounds was initially true from before

Also, as a last resort, you can try using GetTouchingParts

or set a loop like

while wait(0.5) do

inside of the karts main hitbox or just using the main body

Also you should put print statements throughout your code to see what part of it is firing and where does it stop so you can fix it.

the “if outOfBounds” part of the code only triggers when box.Name is COL_BARRIER, for the rest of that function’s runtime it never gets set back to nil, so that wouldn’t work

I’ve print debugged my whole script several times. I already know what the issue is:

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