Ad
Log in to vote
0

Script not printing out player name as it should?

Asked by
CodeWon 65
4 days ago

I was making some basic and random code and nothing happend when I ran it.

local players = {}

game.Players.PlayerAdded:Connect(function(player)
    table.insert(players, player.Name)
end)

for i, v in pairs(players) do
    if v.Name == "CodeWon" then
        print("Hello")
    end
end

1 answer

Log in to vote
0
Answered by 4 days ago
local players = {}

game.Players.PlayerAdded:Connect(function(player)
       table.insert(players, player.Name)
       if player.Name == "CodeWon" then
             print("Hello")
       end
end)

This script should work.

Ad

Answer this question