Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make players in a table be able to see a certain gui?

Look, I have my script connected with trello and underin the script it connects to trello, with this script:

allowedPlayers = {}
allowed = {}
function checkClearance(player)

	for _,v in pairs(allowedPlayers) do
		if v:lower() == player.Name:lower() then
			player.PlayerGui.testgui.Frame.Visible = false
		end
	end
end

function clearTable(tab)
	for i,v in pairs(tab) do
		table.remove(tab, i)
	end
end




function runtrelloupdater()
	local httpser=game:service('HttpService')
	local get=httpser:GetAsync('https://api.trello.com/1/boards/67PfkMXl/lists?key=2caa004003804921e9ec69b5c0f74430&token=b3d0cc2133a07c9de564092ab8553872f3d280d0507dd65f91ec4c5d3c6cc3ee',true)
	local tabel=httpser:JSONDecode(get)
	for i,v in pairs(tabel) do
		if v.name:match('^jjj1212%s?$') then
			local getcard=httpser:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards?key=2caa004003804921e9ec69b5c0f74430&token=b3d0cc2133a07c9de564092ab8553872f3d280d0507dd65f91ec4c5d3c6cc3ee',true)
			local tabal=httpser:JSONDecode(getcard)
			clearTable(allowed)
			--allowed = {}
			for l,k in pairs(tabal) do
				table.insert(allowed,k.name)
			end
		elseif v.name:match('^chicken%s?$') then
			local getcard=httpser:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards?key=2caa004003804921e9ec69b5c0f74430&token=b3d0cc2133a07c9de564092ab8553872f3d280d0507dd65f91ec4c5d3c6cc3ee',true)
			local tabal=httpser:JSONDecode(getcard)
			clearTable(allowedPlayers)
			checkClearance()
			for l,k in pairs(tabal) do
				
				table.insert(allowedPlayers,k.name)
			end
		end
	end
end
runtrelloupdater() while wait(20) do runtrelloupdater() print("lmao") end

But what I don't know how to do if someone is inserted in that table (which works, yes) how they would get a gui appeared..

can anyone help me with this?

2 answers

✓ Accepted answer

The problem is that this should be in a server Script, but (at least with FilteringEnabled on) the server cannot access a player's gui. The best option is to use a RemoteEvent to signify that the player either does or does not have permission to see the gui.

Let's assume the event is in the workspace and is called "TrelloPermissionEvent".

LocalScript (child of PlayerGui):

workspace:WaitForChild("TrelloPermissionEvent").OnClientEvent:connect(function(canSee)
	player.PlayerGui.testgui.Frame.Visible = canSee
end)

CheckClearance function:

function checkClearance()
	local players = game.Players:GetPlayers()
	for i = 1, #players do
		local found = false
		for j = 1, #allowedPlayers do
			if players[i].Name:lower() == allowedPlayers[j]:lower() then
				found = true
				break
			end
		end
		coroutine.resume(coroutine.create(function()
			workspace.TrelloPermissionEvent:FireClient(players[i], found)
		end))
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.