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

How to make something change when a value reaches a certain number?

Asked by 10 years ago

So Im working on making a few things change when the number on a gauge reaches a certain number. [See this place for reference : http://www.roblox.com/WhoDunIt-place?id=112054663 ] How would I go about doing this? I can give more elaboration if needed.

1 answer

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago

What you are going to do need is this..

First you are going to route to it.. If it's an IntValue named 'Cookie' inside workspace it would be like.. (And this is a script located as a child of IntValue 'Cookie'

C = script.Parent
script.Parent.Changed:connect(function ()
if  C.Value == 1 then -- Change 1 to the number needed or wanted.
    -- Code
else
print("Not correct")
end
end)

This is all you need really. what this does is when the IntValue 'Cookie' is updated, it checks to see if the value is == 1, if so it will do what the code is, if it isn't.. It will print 'Not correct'.

0
Thanks. Im having a hard time modifying it though, the script is going to be in a completely different model, and it isnt a value thats being changed, its the name of a child of the model I need to alter. profGRob 5 — 10y
Ad

Answer this question