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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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)
0
I believe this should work myself. GamingZacharyC 152 — 5y
0
Thank you! Andreaaaaxo 6 — 5y
0
Thank you so much, this worked! Andreaaaaxo 6 — 5y
Ad

Answer this question