Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Should I instance "leaderstats" as a folder or an int value ?

Asked by
Khanon 10
5 years ago
Edited 5 years ago
local leaderstats = Instance.new("Folder",player)
    leaderstats.Name = "leaderstats"

or

local leaderstats = Instance.new("IntValue",player)
    leaderstats.Name = "leaderstats"

I would like to know the difference between these two. I recall watching a video in which the publisher told me to make it an IntValue, and not ask questions. It felt strange to me because theres no use of its value, then later on I checked other sources on the internet and they all instanced a folder with that name...

Later on, I even tried

local leaderstats = Instance.new("Part",player)
    leaderstats.Name = "leaderstats"

and that works aswell :D

This may be a trivial question, or a question about efficiency, but I'd like to get an answer nonetheless.

Thanks for your time.

Edit : Thanks for your replies, I also checked

local leaderstats = Instance

But it was a readonly value... so... I glanced for a while at the "Advanced Objects" toolbar and concluded for all of us, that instancing it as a "Folder" is, for now, optimal.

However I'd love to be able to instance simpler objects than even a folder... A folder has 3 Attributes ( one of which being ClassName and the other two already necessary stuff (Name and Parent) ) The only thing I could get rid of would be the "Archivable" behaviour, which can be useful time to time, and is already present on all roblox instances...

So final conclusion : USE A FOLDER.

0
HEY, don't set the parent in the Instance.new() function. It can create lag! BashGuy10 384 — 5y
1
I recommend hiding all the data inside the script itself in server script service that way no hacker can see the data for other players for certain games that would be a benefit! greatneil80 2647 — 5y
0
I actually never thought of that, greatneil80. Or you could hide everything in server storage, if you want to be clean. BashGuy10 384 — 5y
View all comments (2 more)
0
Pretty cool trick I thought of a while ago c: greatneil80 2647 — 5y
0
@BashGuy10 thanks, I checked it and approved that you are right. I won't use the second argument of instancing for that purpose anymore. And @greatneil80 I already like to do pretty much everything from server side whenever I can. However I cant see how your recommendation was referring to the topic. Thanks anyways :) Khanon 10 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

It really doesn't matter, it can be anything, a part, a fire object, a model, a script, you name it. Just name it "leaderstats". But I'd recommend using folders just to be consistent, as the PlayerGui, PlayerScripts, Backpack, StarterGear, have folder icons. I personally use Configuration objects since they're kinda folders specifically for ValueBase instances.

When you try inserting something into a configuration in the explorer, it only lets me insert ValueBase instances from the options. Also because it has a little icon under it, which blends in with the other player folders.

0
Configuration objects best BashGuy10 384 — 5y
Ad
Log in to vote
0
Answered by
3wdo 198
5 years ago

from how i see it use int value if you using 1 currency but use folder if you make multiple currencys like for example 1 is just by using cash but more then 1 would be cash,coins, and gold

1
Really it doesn't matter at all(but configuration objects are best) BashGuy10 384 — 5y

Answer this question