Wait,can it be?The “points” in this line is folder ,too and we can’t change it too?
local points = Instance.new("IntValue")
Wait,can it be?The “points” in this line is folder ,too and we can’t change it too?
local points = Instance.new("IntValue")
IntValue just means you will be putting numbers inside of it.
Like variables in C you have to say what kind of stuff you will be storing. (int abc = 1;)
You can name it anything after the Instance.new.
It wouldn’t be the name but the datatype in the variable.
So we can’t code like this
local abc = Instance.new("Folder")
Instead of
local leaderstats = Instance.new("Folder")
Right?
Variable names do not affect Instance names
local ldfold = Instance.new("Folder") --// make new local var named "ldfold" and assign a new "Folder" instance
ldfold.Name = "leaderstats" --// set the name property of the stored value of "ldfold"
Wait what,so why the system know we are coding on the leaderboard???
Because “leaderstats” is a special name for folders, and when parented to a player, generates a leaderboard GUI.
leaderstats.Name = "leaderstats"
This line right?So the system know we are coding on the Leaderboard
Can we do this:
Abc.Name = "leaderstats"
I do not understand your question, what are you trying to ask here?
The code provided at op basically:
Assuming Abc is a Instance, yes
We are coding about leaderboard right?So where is the line help we know we are coding about it ?
local abc = Instance.new("Folder")
abc.Name = "abc"
abc.Parent = player
Can i do this?if i do this is rihht how the system know we are coding about leaderboard(leaderstats)?
The Roblox engine normally detects if a folder named “leaderstats” is on a Player object, if one exists, it goes through all BaseValues inside the folder that can be turned into a string containing the value and displays it on the player list.
local Players = game:GetService(“Players”) —Gets players
local function onPlayerAdded(player) — When they join
local leaderstats = Instance.new(“Folder”) — Making leaderstats
leaderstats.Name = "leaderstats”
leaderstats.Parent = player — Whenever you get more of a currency it gives you that.
local points = Instance.new("IntValue") — Makes your currency show up
points.Name = "Points" — What you see in the top right bar
points.Value = 0 — How much you start with
points.Parent = leader stats — Makes everything go to the top bar
end
Players.PlayerAdded:Connect(onPlayerAdded)
Because you name the folder “leaderstats” with the line
leaderboard.Name = "leaderstats"
It is a object inside the game which can have a type and a name.
It will stay a folder but will be called leaderstats.
No you cannot, you must set the name into “leaderstats”
local abc = Instance.new("Folder")
abc.Name = "leaderstats"
abc.Parent = player
leaderstats is basically just the name of the top right bar I believe. And doing the code will add things yyou want to it like points.
Why?it just give name ,why it must be like that?
The Roblox engine only accepts “leaderstats”, make a feature request if you don’t want the name to be forced
Oh so that is why the system know we are coding about leaderboard right?
The system knows that we are “coding” about the leaderboard as long a folder named “leaderstats” is inside a “Player” object