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

IntValue doesn't increase using LocalScript, how do i fix this?

Asked by 4 years ago

When i try to increase IntValue, nothing happens, this is mostly the script i use

value = script.Parent.Value

value = value + 1

but it isn't working when i try doing it for menu

0
Ok give us more info, what is "value", where did you put "value" where did you put the LocalScript?, any error in the output window? what do you mean trying to do it for menu? Azure_Kite 885 — 4y

2 answers

Log in to vote
0
Answered by
ScuffedAI 435 Moderation Voter
4 years ago

If we look at the code from the script's perspective we'll be able to find out what's actually going on.

-- The variable will get a number value
-- because of "script.Parent.Value"

-- let's imagine the returned number value is 3
value = script.Parent.Value


value = value + 1
-- The code above will pretty much translate to the following:
3 = 3 + 1

Let's now move on the solution

-- Instead of getting the number value, we instead
-- get the object itself.
object = script.Parent

-- and then set the property "Value" to the previous value
-- with a increment of 1
object.Value = object.Value + 1
0
i will try this megamanyoutuber 25 — 4y
0
no doesn't work still megamanyoutuber 25 — 4y
0
The change is not read by the client? If it still isn't, it probably means that the script cannot find the IntValue. Use WaitForChild(). DeceptiveCaster 3761 — 4y
Ad
Log in to vote
0
Answered by
proo34 41
4 years ago
value = script.Parent.Value.Value

value = value + 1

You forgot to get into the value property

Answer this question