in this code i was wondering if the variable 'player' in the event function must be that variable or it can be anything so what i mean is if i put in anything other than player as my variable would it still work or no?
--by Neosavvy game.Players.PlayerAdded:Connect(function(player) stats = Instance.new("IntValue", player) stats.Name = "leaderstats" Lvl = Instance.new("IntValue", stats) Lvl.Name = "Lvl" Lvl.Value = 0 Nation = Instance.new("StringValue", stats) Nation.Name = "Nation" Nation.Value = "None" Rank = Instance.new("StringValue", stats) Rank.Name = "Rank" Rank.Value = "None" end)
Yes you can put anything other than "player"
Variables can be set to almost anything. The first argument passed to the function connect to the event for PlayerAdded is the reference to the player instance.
You can set the variable's name to anything that lua syntax agrees with.
Example
local players = game:GetService("Players") local function playerAdded(epic) print(epic) end players.PlayerAdded:Connect(playerAdded)
In this case the variable epic
in the connected function playerAdded
's scope is the reference to the newest player added.