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

My textbutton teleport isnt working and im so confused?

The problem is simple. I have put a local script into a textbutton with this code

local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerGui = Players:WaitForChild("PlayerGui")
local LoadingScreen = ReplicatedStorage:WaitForChild("Loading")

script.Parent.MouseButton1Down:Connect(function()
	local TempLoadingScreen = LoadingScreen:Clone()
	TempLoadingScreen.Parent = PlayerGui
	TeleportService:SetTeleportGui(TempLoadingScreen)
	TeleportService:Teleport(6958449453, player)
end)

When i press the textbutton in roblox studio or in game neither works. I've tried putting a print statement above the line "local TempLoadingScreen = LoadingScreen:Clone()" to see if it even initiates the function - nope. I have no idea how to fix. I have gotten reccomendations such as enable the third party teleport thing in game setting, still didnt work changing the mousebutton1down into mousebutton1click or up still doesnt work. Could someone please help me in solving this issue?

1 answer

local PlayerGui = Players:WaitForChild("PlayerGui")

Think that should be player:WaitForChild("PlayerGui",2) bc PlayerGui is inside the player, not game.Players

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