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

PlayerGui not working?

Hi. For some reason this script isn't working. I don't know why, it was working absolutely fine before I logged off for bed last night, came back on, not working. Basically I just want the button to be visible if a certain player joins the game, in this case, me. The script is a local inside StarterGui. Any help to resolving this will be appreciated.

local plr = game.Players.LocalPlayer
plr:WaitForChild("PlayerGui")
if plr.Name == "toughjohncena1256" or plr.Name == "Player1" then
plr.PlayerGui.cars.OPEN.Visible = true
end

7 comments

0

Are there any errors? Is there definitely something named "cars" and "OPEN" in the playergui?

0

There are no errors, sorry, forgot to say. They are both in the StarterGui, yes.

0

Got any errors?

0

No.

0

Is "cars" visible when you make the Open button visible.

0

There's no option to make the whole ScreenGui visible. The button (open) is not visible, as the idea is for it to appear to the right person. If I made it visible, everyone would see it.

0

Oh, didn't even hit me that cards was a ScreenGui object. -_-

2 answers

game.Players.PlayerAdded:connect(function(plr)
if plr.Name ==  "toughjohncena1256" or plr.Name == "Player1" then
wait()
plr.PlayerGui.cars.OPEN.Visible = true
end
end)

Write it in serverscript :)

2 comments

0

It would not work in a Server Script since it utilizes LocalPlayer. You also did not take into account if the game were FilteringEnabled which would result in the script not working at all since Server Scripts DO NOT control PlayerGui in any way.

0

I didn't add any local player thing here... And also I tested it and it works o.o

I removed the button and based it around a tool instead, select and it brings up the Gui, deselect and it removes it. I'm just as happy with this. Thank you all for trying.

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