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

Local script in a text button GUI doesn't work? No errors!

I've already asked this question previously- and yes, I've received answers, but they didn't help me. If I don't receive answers on this question, I won't bother to ask again. Basically, this is a local script inside of a text button GUI. I'm trying to make the text button make another frame visible with a function and click event, but it doesn't work.

I would be incredibly thankful if someone could help me!

I'm not asking for a simplification because that will not help me, I'm looking for a correction to this script. I'm fairly new to scripting, so please don't judge me for getting a script this easy wrong.

DETAILS: Screen GUIs are used Frame is used Text Button is used Local Script is used

SCRIPT:

smitts = game.StarterGui.ScreenGui2.Framel

function smiths()
	smitts.Visible = true
	end
end

script.Parent.MouseButton1Click:connect(smiths)

I've even tried making the script more complicated..

1 answer

✓ Accepted answer

Don't use StarterGui - it's used for holding guis that will be replicated to each clients' PlayerGui. What the client sees on their screen are descendants of their PlayerGui.

Here's a simple fix:

wait()
local pgui = game.Players.LocalPlayer.PlayerGui
local smitts = pgui.ScreenGui2.Frame1

function smiths()
       smitts.Visible = true
end

script.Parent.MouseButton1Down:Connect(smiths)

3 comments

0

I believe this should work myself.

0

Thank you!

0

Thank you so much, this worked!

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