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

My GUI made from instance.new is not showing?

Asked by 3 years ago

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.

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) Arkiteckt 38 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
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)
Ad
Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

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!

0
If you need any help on scripting and need help from me, please contact me in ROBLOX (message) Xapelize 2658 — 3y

Answer this question