local playerlist = game.Players.LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('PartyGUIS'):WaitForChild('PlayerList')
print('help')
--[[script.Parent.MouseButton1Down:Connect(function()
print('WHAT THE ACTUAL')
if playerlist.Visible == true then
playerlist.Visible = false
else
playerlist.Visible = true
end
end)]]
function open ()
if playerlist.Visible == true then
playerlist.Visible = false
else
print('SAFSDFSAFDFDAFAFD')
playerlist.Visible = true
end
end
script.Parent.MouseButton1Click:Connect(open)
In a local script. HOW in the world does this not work? It works in studio, but not in-game.
A simple thing you can do for coding something like this:
function open ()
if playerlist.Visible == true then
playerlist.Visible = false
else
print('SAFSDFSAFDFDAFAFD')
playerlist.Visible = true
end
end
could be like so:
function open()
playerlist.Visible = not playerlist.Visible
end
try not to use if statements for things that could be much more simple. Also could you provide more info on the GUI, is it the actual pre-made Playerlist every game has on roblox or is it just a GUI you made?
You never stated that it wasn’t printing anywhere. You asked how does the script not work, you need to be more specific in your post so we can get a sense of what you need help with immediately . Have you tried printing before the if statement in the function? To see if the script is reaching the function 100% of the time?
Alright, so there is probably a problem with this variable then. The script is most likely infinitely waiting for the child “PlayerList”. That’s my theory at least. I THINK this can happen if “PlayerList” loaded in before the script even began waiting for it but I don’t exactly know what causes this issue fully.
local playerlist = game.Players.LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('PartyGUIS'):WaitForChild('PlayerList')
That’s not what I meant by exception. An exception is a runtime error.
Anyways, have you tried using the Activated event? This is what I use over MouseButton1Click and it implies it works for all input types. The latter might work too but it makes the implication that it only fires on mouse clicks.
For testing purposes try placing The print('help') before the all of the WaitForChilds, publish the place and then open the Developer Console , and see if anything prints.
Nothing prints in Dev Console (F9 in-game). Yes I have clicked published more than 10 times over the course of the last few hours heehee. The local script is inside a button.