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

How to create values with a script?

Asked by 6 years ago
Edited 6 years ago

Hello,

I am wondering if it's possible / how do you create a StringValue inside a script and put it into workspace, same with IntValues and folders.

I would like to get something using HTTPService, and put them inside a variable, which will be "call" "police" "ems" "fire" "swat" and those go inside a folder, how do you do this?

Like this: https://gyazo.com/f746c84518f279f6f00174674c57a81c but via a script.

Thanks

0
local int = Instance.new("IntValue", workspace) cfiredog 274 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

To create new objects or instances, you would use Instance.new().

You can make it a variable and then set it's parent. You can also make a folder this way

folder = Instance.new("Folder", workspace) -- workspace is the parent of the folder or where it's gonna be inside, you can change it to a different service or path.

folder.Name = "1" -- name it inside the quote! just don't remove the quote marks

value = Instance.new("StringValue", folder) -- folder will be the parent of this newly created value or where it's gonna be inside in
value.Name = "Call"
value.Value = "" -- since it's a string value, it has a value inside that can have a string text value inside

value1 = Instance.new("StringValue", folder) -- don't have the variable named the same unless you're not going to access it later
value1.Name = "EMS"
value.Value = ""

HTTPService wouldn't be required to create values but it is often used in data store scripts that can be used for saving values when a player leaves or joins the game.

0
You use datastores for that, not HTTP service. hiimgoodpack 2009 — 6y
0
Yea, but I prefer HTTPService, because I am storing most of the games mechanics. Starhawke_r 11 — 6y
0
I'm not sure I follow. are you asking to save with HTTPService? In that case, use DataStore. User#18043 95 — 6y
0
I am saving the calls (emergencies), in side a Database, and I thought it's easier to do everything, so I can edit it when I want, and it's my information, not ROBLOX's. And I can save the data on my website so if I want to edit something I can, without using datastore Starhawke_r 11 — 6y
0
well u set the question to be confusing so i cant help u now User#18043 95 — 6y
Ad

Answer this question