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

PlayerGui not working?

Asked by 8 years ago

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
0
Are there any errors? Is there definitely something named "cars" and "OPEN" in the playergui? jjwood1600 215 — 8y
0
There are no errors, sorry, forgot to say. They are both in the StarterGui, yes. toughjohncena1256 57 — 8y
0
Got any errors? UserOnly20Characters 890 — 8y
0
No. toughjohncena1256 57 — 8y
View all comments (3 more)
0
Is "cars" visible when you make the Open button visible. M39a9am3R 3210 — 8y
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. toughjohncena1256 57 — 8y
0
Oh, didn't even hit me that cards was a ScreenGui object. -_- M39a9am3R 3210 — 8y

2 answers

Log in to vote
-1
Answered by 8 years ago
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 :)

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. M39a9am3R 3210 — 8y
0
I didn't add any local player thing here... And also I tested it and it works o.o Dominqx 0 — 8y
Ad
Log in to vote
-1
Answered by 8 years ago

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.

Answer this question