Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's the difference between a StringValue and an IntValue?

What we use string Value for and Int Value And what's the difference between the events i can do with them?

1 answer

✓ Accepted answer

StringValues

StringValue class has a Value property which holds a string. A string is just some text.

local stringVal = Instance.new("StringValue");
stringVal.Name = "randomText";
stringVal.Value = "any text can be here";
stringVal.Parent = game:GetService("Workspace");

IntValues

IntValue class has a Value property aswell, but it holds 32 bit signed integers. Signed means it can represent negatives as well. 32 bits means that is how many bits are used to represent the number. There are 8 bits in a byte. It cannot represent fractions. If you need to represent fractions, use NumberValues. NumberValues store 64-bit doubles, so they can represent bigger numbers.

local numberVal = Instance.new("NumberValue");
numberVal.Name = "randomNumVal";
numberVal.Value = 23142254;
numberVal.Parent = game:GetService("Workspace");

3 comments

0

Yep thats correct!

0

Nice

0

You put stringVal instead of numberVal in the second code.

This discussion is preserved as it was. New answers, comments, and votes are closed.