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

Why doesn't my Billboard GUI script for my Screen GUI work?

Asked by 4 years ago
Edited 4 years ago

I've made a billboard gui with a textbutton. When clicked. it's supposed to allow a screen gui to appear, however this doesn't happen. I even tested with something else. I wrote a script for it to print "Good" when clicked, and that worked, but when I transfer back to my script for the screen gui it doesn't do anything. Honestly this should be so simple to script but apparently it's not.

function onClick()
    game.StarterGui.ScreenGui.Infos.Sun.Visible = true
end

script.Parent.MouseButton1Click:Connect(onClick)
0
Thanks! OrchestralGuy 11 — 4y

2 answers

Log in to vote
0
Answered by
FirezDevv 162
4 years ago

The reason is a Players Gui is in the player as game.Players.LocalPlayer.PlayerGui not Screen Gui Here is the fixed script, and make sure its a local script as LocalPlayer is only for local scripts

function onClick()
2       game.Players.LocalPlayer.PlayerGui.ScreenGui.Infos.Sun.Visible = true
3   end
4    
5   script.Parent.MouseButton1Click:Connect(onClick)

Ad
Log in to vote
0
Answered by
ghxstlvty 133
4 years ago

Use this script instead as your current script has a few errors with the function.

script.Parent.MouseButton1Click:Connect(function()
    game.StarterGui.ScreenGui.Infos.Sun.Visible = true
end

If any errors please let me know.

0
It still wont run and doesnt return anything in output. OrchestralGuy 11 — 4y
0
Apologies, it must be an error on your side then. ghxstlvty 133 — 4y

Answer this question