So... I wanted to ask how I can check if a Player's name matches one name inside a table inside a Module script...
Module Script
local ShowGui = { "Player1","Player2"}
return Whitlelisted
Local Script
local Settings = require(game.Workspace.Settings)
local sg = Settings.ShowGui
game.Players.PlayerAdded:connect(function(p)
if sg[p.name] then
script.Parent.Parent.ScreenGui:Clone().Parent = game.Players.LocalPlayer.PlayerGui
end
end)
Well.. I don't get any erros it just doesn't works...
Is it because my "Caller" Script is a Local Script and not a Normal script?
I made it to a local script because I want to access the LocalPlayer.
Would it work with script.Parent.Parent.ScreenGui:Clone().Parent = p.PlayerGui?
It's maybe a bit too much what I wrote but.. I think this explains my problem in detail.. (I hope)
I just don't know what I did wrong...
Also I am sorry if that local ShowGui = {} thingy is not a Table.. I mostly say wrong names I just really have to learn the name differences :P
Edit:
No need to help anymore. Solved it myself after trying and trying

2 comments
Arrays are mappings from
1...#arrayto arbitrary Lua values, and to get something out of an array you can doarray[1],array[2],array[3], etc etc, they are integer keys, not string keys. So you'll want to use a dictionary or loop through the arrayAlso don't make it a local script or else PlayerAdded doesn't fire for the local player