This is a LocalScript inside of a PlayerGui.
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local gui = script.Parent
local placeId = 2528001957
local function onTouched(hit)
local dude = hit.Parent
local player = Players:GetPlayerFromCharacter(hit.Parent)
wait(.5)
gui.TextButton.Visible = true
gui.Enabled = true
workspace.bigwelltp.CanCollide = false
wait(1)
workspace.bigwelltp.CanCollide = true
wait(4)
gui.TextButton.Visible = false
gui.TextButton2.Visible = true
wait(4)
gui.TextButton2.Visible = false
gui.TextButton3.Visible = true
wait(4)
gui.TextButton3.Visible = false
gui.TextButton4.Visible = true
gui.Repent.Visible = true
gui.YOLO.Visible = true
gui.Repent.Activated:Connect(function()
gui.TextButton4.Visible = false
gui.Repent.Visible = false
gui.YOLO.Visible = false
gui.TextButton.Text = "You are forgiven."
gui.TextButton.Visible = true
wait(1)
TeleportService:Teleport(player, placeId)
end)
gui.YOLO.Activated:Connect(function()
gui.TextButton4.Visible = false
gui.Repent.Visible = false
gui.YOLO.Visible = false
gui.TextButton.Visible = true
dude.Humanoid.Health = 0
end)
end
workspace.bigwelltp.Touched:Connect(onTouched)
Everything works except for line 37, when the player teleports to a new game. I've used this method to teleport players in other games and it worked just fine. And the game it's supposed to teleport to is a StarterPlace of another game, so it's not like the teleport destination is illegal or anything.
I've tried changing how the player is found (local player = script.Parent.Parent.Parent was what I had originally), but no matter what I do, the same error comes up.
Is there any way to make this work? Or is it a weird bug?

1 comment
Oh, wow, that was a really silly mistake. Thanks for pointing that out!