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

Value scripting (If then) help? [ANSWERED]

Asked by 4 years ago
Edited 4 years ago

I tried making this script where if the value hits this then it does that except the script isnt working if script.Parent.Value == 107 then

2 answers

Log in to vote
0
Answered by 4 years ago

thank you

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

Is the name of the value "Value"? Because if then you always need to define the value of a value, to compare it to something else. If the name of the value is "Value" then the script should actually look like this:

script.Parent.Value.Value == 107 then

EDIT: I see the problem now, when you put this in the script, it only checks the value once, then stops, to solve this you could use a loop to check the value every so often, perhaps like this

while true do
    if script.Parent.Value == 107 then

    end
    wait(0.5)
end

This would check the value every half second to see if it is 107 You could also use this:

script.Parent.Changed:Connect(function()
    if script.Parent.Value == 107 then

    end
end)

This would check if the value is 107 every time the value is changed

0
The script is in the value btw YoutubeRedride -11 — 4y

Answer this question