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

how can i get users from a module script and make it print if the user is the correct user?

i want to make a script that does print when a player joins and has the same name/userid as the one in the module script but i dont know how to do that, here's the script:

local Whitelist = require(script.Parent.Whitelist)
local player = game:GetService("Players")

player.PlayerAdded:Connect(function(plr)
	if plr.Name == Whitelist.whitelist.Users then
		print('Whitelisted')
	else
		print('Not Whitelisted')
	end
end)

and here's the module script:

local whitelist = {}

whitelist.Users = {"mahid786", "GameTime_Studio", "diegodamaw", "amirgun2", "Bloxy_Cone"}

return whitelist

can someone please help me?

1 answer

✓ Accepted answer

Ok so, a ModuleScript is not required, you can put the usernames in a normal script inside ServerScriptService(SSS). Or alternatively use this script:

local admins = {"player1","player2"}

game.Players.PlayerAdded:Connect(function(player) 
	for i = 1, #admins do
			if admins[i] == player.Name then
--whatever you want

2 comments

0

thanks this works!

0

welcome!

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