It is a GUI I made. Thanks for the if advice!
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?
I didn’t say I stated if I printed. I said I stated the exception. I tried it and nothing prints still.
Ahhhh okay. Does “Help” print in the beginning of the script?
Nope! That’s why I find it so weird. It print it studio testing though!
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.
Also another reason to use Activated
By the way you should avoid long method call chains and you could definitely shorten that chain if you used variables.
Hm, I only added the waits cause it was happening when I just did it normally.
Still nothing prints, even after using the activated
For testing purposes try placing The print('help')
before the all of the WaitForChild
s, publish the place and then open the Developer Console , and see if anything prints.
I don’t think so. I did it normally without waits and still nothing…
Nothing prints in the developer console( not the studio debugger)?
If not that’s weird, are you sure that the game was published, when trying it in game?
Also if I may ask where is the local script?
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.
This looks like a team create publishing issue. Are you using team create by any chance?
I turned on team create so that it auto saves, but nobody is actually in the “team”. So, any fixes? I actually manually publish it too.
I’d suggest turning off team create if you’re the only one in the session/team. I believe the issue here is you do not publish script changes as this was recently introduced with collaborative editing. So either turn off team create or turn off collaborative editing.
Note: Before turning off team create or collaborative editing, make sure to actually publish the script changes! This button can be found in the script context menu and clicking publish chnages.
Make sure you actually commit your changes in team create! Because of collaborative editing, you need to push the code to the server. It will work only locally until then.
Oh dear. Please avoid daisy chaining your waits. Furthermore, you could simply this code so that it sets the visibility property to the opposite of its current property. Would help some.
local LocalPlayer = game:GetService("Players").LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local playerList = PlayerGui:WaitForChild("PartyGUIS").PlayerList
local function toggleList()
playerList.Visible = not playerList.Visible
end
script.Parent.MouseButton1Click:Connect(toggleList)
That aside, your code should be working. Some more details will need to be provided. For example, where is this LocalScript located? Make sure it’s located in a place where it will run. Have you ensured your changes were published? Make sure to hit Alt + P or Publish to Roblox in the file menu.
Do you have collaborative editing on? In that case, copy your script, then turn collaborative editing off and paste the script back in.
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)]]
script.Parent.MouseButton1Click:Connect(function()
print('Hi')
if playerlist.Visible == true then
playerlist.Visible = false
else
print('SAFSDFSAFDFDAFAFD')
playerlist.Visible = true
end
end)