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

I keep getting an error for an attempt to call field 'Value' (a number value). How do I fix?

Asked by 4 years ago

I made want it to combine a percentage of something. If I remove the percentage part, it works? Although if it's there, I get this error: attempt to call field 'Value' (a number value).

This is the script:

script.Parent.Text = "Pollution Levels : " .. workspace.GlobalStats.Pollution.Value "%"

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Try using

script.Parent.Text = "Pollution Levels : "..workspace.GlobalStats.Pollution.Value.."%"

What you did was you did was:

string..num string

instead of string..num..string

(You forgot to connect the string with ".." and used " " instead)

Also, you put spaces in between the values and ".." don't know if it changes anything but it's unnecessary

Ad

Answer this question