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

Gui Clones in game.StarterGui but it doesn't Appear on screen?

Asked by
KenzaXI 166
9 years ago

Hi, I made a script which gives you a Gui, and when you click it you start game and another Gui should appear, but it doesn't, I drag the Gui from Lighting to StarterGui and it appears, But when I use the script to clone it, It won't work, and I don't know why. Here's the script:

local i = script.Parent
local map = workspace.sa
local gui = script.Parent.Parent.Parent
local tele = game.Lighting.Tele
function onButtonClicked()
    local plr = game.Players.LocalPlayer
    local character = plr.Character
    character:MoveTo(map.Position)  
    tele:Clone().Parent = game.StarterGui
    script.Parent.Parent.Parent:Destroy()
    end
i.MouseButton1Down:connect(onButtonClicked)

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
9 years ago

Da Problem

Your problem is that you're trying to put it in the StarterGui, which isn't what the Players see in-game. Players see a the PlayerGui, which is a Service set in the Player.


Here's Da Fix

So now to fix this, let's move it to the correct position. Here's how we'd do that:

local i = script.Parent
local map = workspace.sa
local gui = script.Parent.Parent.Parent
local tele = game.Lighting.Tele
function onButtonClicked()
    local plr = game.Players.LocalPlayer
    local character = plr.Character
    character:MoveTo(map.Position)  
    tele:Clone().Parent = plr.PlayerGui --Switched to PlayerGui
    script.Parent.Parent.Parent:Destroy()
    end
i.MouseButton1Down:connect(onButtonClicked)

So now it should work correctly.


Anyways, I hope this helped. If you have any further problems/questions, please leave a comment below :P

-Dyler3

0
Thanks man, Cheers! KenzaXI 166 — 9y
0
No prob, glad to help :P dyler3 1510 — 9y
Ad

Answer this question