Visible = true not functioning?

So when the update() is used when the script first runs, it works. However, when it gets activated by the player.PlayerGui.Location.Update.OnServerEvent:Connect(function() it doesnt? Im completely confused. I know the player.PlayerGui.Location.Update.OnServerEvent:Connect(function() is working to because I added a print() to check earlier.

local function update()
	local zones = pdata.playerd.UnlockedZones
	if table.find(pdata.playerd.UnlockedZones, script.Parent.Name) then
		script.Parent.Visible = true    
	end
end

update()

player.PlayerGui.Location.Update.OnServerEvent:Connect(function()
	update()
end)

This leaves a lot of questions:
What is pdata? What is pdata.playerd? UnlockedZones? script.Parent.Name? Is there an error?
Did you add a print after the table.find? If that doesn’t print, its your logic. Otherwise, maybe the ScreenGui is not Enabled. You could also check the Visible property on the Gui.

1 Like