Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My textbutton teleport isnt working and im so confused?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
local PlayerGui = Players:WaitForChild("PlayerGui")

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

Ad

Answer this question