I am trying to check player if the UserId is match with the list. If is match with the list, it will make the BoolValue into True. But, it doesn’t work. I also added a print statement but it does print but doesn’t work still.
local Players = game.Players
local list = {
1206342601,
}
Players.PlayerAdded:Connect(function(Player)
if table.find(list,Player.UserId) then
local Character = Player.Character or Player.CharacterAdded:Wait()
Character.Checker.Test.Value = true
print("Worked for Check")
end
end)
Is the character being loaded in fast enough? Maybe put a temporary wait after the player has been added just in case. Also, are there any errors being printed? Try changing
The player might be loading in before the PlayerAdded event. Try doing this:
local Players = game.Players
local list = {
1206342601,
}
local function CheckPlayer(Player)
if table.find(list,Player.UserId) then
local Character = Player.Character or Player.CharacterAdded:Wait()
Character.Checker.Test.Value = true
print("Worked for Check")
end
end
for _,Player in pairs(game.Players:GetPlayers()) do
CheckPlayer(Player)
end
Players.PlayerAdded:Connect(function(Player)
CheckPlayer(Player)
end)