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

Script not printing out player name as it should?

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

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.

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