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

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

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)

1 comment

0

Thanks!

2 answers

✓ Accepted answer

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)

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.

2 comments

0

It still wont run and doesnt return anything in output.

0

Apologies, it must be an error on your side then.

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