I made a leaderstat instance for a obby game, and I want to find a way to identify it:
function PlayerAdded(player)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
local Stage = Instance.new("NumberValue")
Stage.Parent = leaderstats
end
how do i Identify the player?
Please, All Answers Help. Thank you.
What do you mean by identify the player, but I do know how to identify the new instance, use the Name property
function PlayerAdded(player)
local leaderstats = Instance.new("Folder") -- Creates the instance with the classname, also don't use the second parameter, as to my knowledge, it is deprecated
leaderstats.Name = "leaderstats" -- player.leaderstats
leaderstats.Parent = player -- always set the parent at the end of initializing, so that all relevant data is filled out
local Stage = Instance.new("NumberValue") -- Creates the instance with the classname, also don't use the second parameter, as to my knowledge, it is deprecated
Stage.Name = "Stage" -- player.leaderstats.Stage
Stage.Value = 0 -- or any default value
Stage.Parent = leaderstats -- always set the parent at the end of initializing, so that all relevant data is filled out
end