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

My teleport GUI works in studio tests but not in the actual game?

This script works perfectly fine within studio but when I play test it through regular Roblox it doesn't work.

I have tried several things and I have an idea with what is wrong but I am a bad coder and I can't seem to fix it.

Any suggestions?

Btw this is a local script.

local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent

local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 0, 0, 36) textButton.Size = UDim2.new(0, 90, 0, 30) textButton.BorderSizePixel = 3 textButton.TextColor3 = BrickColor.Black().Color textButton.BackgroundColor3 = BrickColor.Yellow().Color textButton.BorderColor3 = BrickColor.Red().Color textButton.Text = "Secret Hideout"

textButton.MouseButton1Down:connect(function() game.Players.LocalPlayer.Character.UpperTorso.CFrame = game.Workspace.SecretHideout.CFrame end)

1 answer

Found a way to fix this

just added a wait to the script and now it works :/

local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent

local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 0, 0, 36) textButton.Size = UDim2.new(0, 90, 0, 30) textButton.BorderSizePixel = 3 textButton.TextColor3 = BrickColor.Black().Color textButton.BackgroundColor3 = BrickColor.Yellow().Color textButton.BorderColor3 = BrickColor.Red().Color textButton.Text = "Secret Hideout"

textButton.MouseButton1Down:connect(function() wait(1) game.Players.LocalPlayer.Character.UpperTorso.CFrame = game.Workspace.SecretHideout.CFrame end)

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