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

My GUI made from instance.new is not showing?

So, I am trying to make a server create system. I am trying to make a GUI button that if you click, makes another GUI. When I have the script and press the button it makes the GUI (I can see in explorer) but I am not able to see the frame.

My Script:

`local Tutorial = Instance.new("Frame") local OpenFrame = Instance.new("TextLabel")

script.Parent.MouseButton1Click:Connect(function(click)

Tutorial.Name = "Tutorial"
Tutorial.Parent = game.StarterGui.ScreenGui.Data
Tutorial.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
print('Made frame')

end)`

Thanks.

1 comment

0

local Tutorial = Instance.new("Frame") local OpenFrame = Instance.new("TextLabel") script.Parent.MouseButton1Click:Connect(function(click) Tutorial.Name = "Tutorial" Tutorial.Parent = game.StarterGui.ScreenGui.Data Tutorial.BackgroundColor3 = Color3.fromRGB(170, 0, 0) print('Made frame') end)

2 answers

✓ Accepted answer
local Tutorial = Instance.new("Frame") local OpenFrame = Instance.new("TextLabel")

script.Parent.MouseButton1Click:Connect(function(click)
       Tutorial.Name = "Tutorial"
       Tutorial.Parent = click:WaitForChild("PlayerGui")
       Tutorial.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
       print('Made frame')
end)

NOTE: Use this as a LocalScript.

A lot of people having problems on GUIS not opening, but now, instead of StarterGui, use PlayerGui

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui") -- access for PlayerGui, since you need to use LocalPlayer, use a LocalScript!
local Tutorial = Instance.new("Frame") 
local OpenFrame = Instance.new("TextLabel")
script.Parent = game:GetService("StarterPlayer").StarterPlayerScripts
script.Parent.MouseButton1Click:Connect(function(click)
Tutorial.Name = "Tutorial"
Tutorial.Parent = PlayerGui.ScreenGui.Data
Tutorial.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
print('Made frame')

-- since there is no function or any statements, end) is not needed!

I hope this works, thanks for reading!

1 comment

0

If you need any help on scripting and need help from me, please contact me in ROBLOX (message)

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