Normal script crashes game without reason

I’ve had this issue since I made the game where I used the code.
The code is a simple leave button, 5 lines long.

local tps = game:GetService("TeleportService")


Now here’s the thing: Whenever the button is clicked. Roblox crashes.
It happens for everyone, I’ve had friends and players report it. Everyone crashes.
It’s not that crash when Roblox’s popup says “Roblox has crashed and needs to quit, sorry!”. It’s that crash when the tab freezes, gets white and windows asks you to quit Roblox.

Is there a reason fat all for that to happen? Can this be fixed?
I have this code in the game on another button, too. That one doesn’t crash anyone. Code is the same.

Before anyone would ask, no the 2 scripts aren’t located in the same button.

1 Like

It could be that the game you’re teleporting players to is causing them to crash, or there’s a different script that just acts up because the player is re-parented or their character is re-parented.

I don’t have any scripts that repeatedly check if the player character exists. As mentioned, I have more scripts that have the same code, same id. The place isn’t a problem

Does it at least teleport? I know that teleport service is pretty slow (took me 30 seconds once)

I would teleport from the client I guess, maybe it’s a replication issue.

They don’t teleport. As the button is pressed Roblox crashes after 3-5 seconds.

1 Like