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

Why is Teleporting crashing?

Im creating a haunted house game in which you walk through a door, and it teleports you to another game inside the main game. I copied the ID from the "Copy ID" choice in studio under the Games folder. Here's the line of code for the teleporter:

local Part = game.Workspace.TPMePlox


Part.Touched:Connect(function(hit)
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if Player ~= nil then
		game:GetService("TeleportService"):Teleport(5781381138, Player)
	end
end)

HOWEVER, it will rarely teleport me to the game, but mostly it just sends me to a daytime skybox and crashes... I have searched my game for viruses, changed the code 100 times, yet nothing seems to work... HELP ME!

2 comments

0

Is teleportservice on?? Just a quite simple question which is stupid but wondering

0

I believe it is

1 answer

If you are testing in Studio, it won't work. As mentioned in the article below : https://developer.roblox.com/en-us/api-reference/class/TeleportService

You have to publish the game and then test it in Roblox app. This is the statement by Roblox :

This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application.

Lemme know if it helps!

3 comments

0

No i'm not, im publishing and testing on the app.

0

Are the both places published/

0

yes they both are, I tried creating 2 new games and both crashed while teleporting

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