Hey all! It’s been a while since I have touched scripting but I decided to play around with GUI’s today. Now I’m trying to make a very very very simple UI where if I press a button then it should make another window appear. But for some reason it doesn’t work at all nor does debugging to see if it runs the code at all doesn’t work either.
Maybe I’m doing this entirely wrong but a example or anything would be helpful.
-- Settings GUI
local imageButton = script.Parent
-- Options GUI
getOptions = game:GetService("StarterGui")
getOptions.Options.Frame.Visible = false
local function onMouseClick()
local optionFrame = getOptions.Options.Frame
optionFrame.Visible = true
end
imageButton.InputBegan:Connect(onMouseClick)
I honestly can’t tell if I shouldn’t be doing this sort of thing in StarterGui or it’s a filterenabled sort of issue.
local player = game.Players.LocalPlayer
local imageButton = script.Parent
local options = player.PlayerGui:WaitForChild("Options")
options.Frame.Visible = false
local function onMouseClick()
local optionFrame = options.Frame
if optionFrame.Visible == false then
optionFrame.Visible = true
else
optionFrame.Visible = false
end
end
imageButton.MouseButton1Click:Connect(onMouseClick)
Edit: Just noticed that it was already solved. My apologies.
Gah never mind, I made a place, but I was too slow! Button_thing.rbxl (45.6 KB)
And for the record, no need to do any re-parenting. It all goes to where it is supposed to be on execution, just use correct references when coding, i.e. don’t do half your code using script.Parent to locate stuff and then use a StarterGui to locate the rest. Keep it consistent!