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

Why is the :Teleport() function not working/taking forever? [SOLVED]

So basically I have a portal thing in my game that teleports players that touch it to another place. A few minutes ago this stopped working. I'm sorry if that sounds vague, but all this script does now is show a loading screen GUI (which is supposed to happen) and then do nothing else. I'm not sure if it's just taking a long time, or if it's just not working. I know the game doesn't freeze because I can still move around and stuff. I didn't even change the script. I'm not sure what's causing this issue. Here's my code:

TeleportService = game:GetService("TeleportService")
playerT = script.Parent.HumanoidRootPart

tp1code = 4811616387 -- place code
tp2code = 4834480289

player = game.Players:GetPlayerFromCharacter(script.Parent)
load = player.PlayerGui.ScreenGui.TeleportLoading
load.Visible = false

teleporting = false

print(player)

playerT.Touched:Connect(function(touch)
	if teleporting == false then
		if tostring(touch) == "TP1" then
			teleporting = true
			load.Visible = true
			TeleportService:Teleport(tp1code, player)
		end
		if tostring(touch) == "TP2" then -- not sure if this works
			teleporting = true
			load.Visible = true
			TeleportService:Teleport(tp2code, player)
		end
	end
end)

The script is located in the starter character scripts folder. It's a normal script (not a local script or a module)

TP1 is just the name of the part you have to touch to get teleported. I'm not sure if TP2 is working, I'll test it soon.

EDIT: Ok, It tested the TP2 part, and it works. I double checked the place codes I put into the :Teleport() function, so I know those aren't incorrect.

EDIT: Ok, so I tested it a few more times and it said "Attempted to teleport to a place that's restricted." I'm confused. My place isn't restricted or anything.

1 comment

0

lol

1 answer

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