So basically I'm trying to make it so whenever you click something using a ClickDetector the TextLabels inside my LabelGui go invisible. Thing is, nothing happens, and the Output doesn't show any errors.
I have it all set out properly, and I've debugged the Script, yet it doesn't work. The printing in the debugging works but the line that is supposed to make the TextLabels invisible isn't.
Any help would be appreciated!
Script - Located in the Model going to be clicked
local remote = game:GetService("ReplicatedStorage").Events.ClickEvent
script.Parent.ClickDetector.MouseClick:Connect(function()
for i,player in pairs(game.Players:GetPlayers()) do
remote:FireClient(player, "eventClick")
end
end)
-- I don't need to debug this since it works in firing the `LocalScript`, meaning it works perfectly.
Click(LocalScript) - Located in PlayerGui.Clicks.Click (Clicks is a Folder, Click is the LocalScript)
local remote = game:GetService("ReplicatedStorage").Events.ClickEvent
local getchildren = script.Parent.Parent:WaitForChild("LabelGui")
remote.OnClientEvent:Connect(function(eventClick)
if eventClick == "eventClick" then
getchildren:GetChildren().Visible = false
print("yolo") -- Debugging to see if it works
end
end)
If you'd like to see more information and where I've placed my Events and Scripts, LocalScripts, etc then let me know and I'll post it in the Comments. I haven't posted it in this because I don't think it is the issue.
Thanks!
#EDIT : I took out the WaitForChild for the getchildren variable and it gave me the error, LabelGui is not a valid member of 'PlayerGui'. Is this helpful? Line 2 on the LocalScript is the error for the getchildren line not working.

3 comments
Okay thanks, but what if I have 2 textlabels and i want one to be invisible and the other to be visible, what would I do
I read your comment on gioni01's answer where you wanted one to be invisible and the other to be visible. My method checks the name property, but you can make any check you like.
okay thanks!!