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

Having an issue w/ this whitelist player GUI script?

So, this system is meant to work so that if the player is whitelisted in the script, when they click the model in workspace, it'll give them the GUI. If they're not whitelisted, it prints that the player doesn't have the license, and doesn't give the GUI. So, the issue I'm having is that its not recognizing the player names in the whitelist. The script prints the "Player not allowed" every time I click it, when my character name is in the script.


script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
	if playerWhoClicked.PlayerGui:FindFirstChild("ShopGui") == nil then
		if playerWhoClicked.Name == {"alexduskthorn", "Player1"} then
			print ("Player has license")
			local gui = script.ShopGui:Clone()
			gui.Parent = playerWhoClicked.PlayerGui
			gui.Frame.Main.Disabled = false
		else
			print ("Player does not have license")
		end
	end
end)

1 answer

✓ Accepted answer

on line 3 - you are comparing the player's name with the table object itself rather than with each value that it holds

try:

 if table.find({"alexduskthorn", "Player1"},playerWhoClicked.Name) then

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