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

Why does the value only changes 2 times and then stops working? [closed]

Asked by 6 years ago

Here's the script :

local v =game.Workspace.AV
script.Parent.Touched:Connect(function(part)

       if v.Value ~= 2 then
 v.Value = 1
         end
end)

The script checks if the value is equal to 2 and then it changes it to 1 when the part is touched.

There's another script that changes the value from 1 to 2.

Closed as Non-Descriptive by evaera

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
RayCurse 1518 Moderation Voter
6 years ago

Your script checks whether or not v.Value is not equal to 2. You mentioned that you have another script that changes the value from 1 to 2. Here lies your problem. When the value turns to 2, the condition v.Value ~= 2 becomes false and there will no way to turn the value back to 1 again (assuming that there are no other scripts involved).

0
Oh true, and how can I fix it? Add a loop? carlito1236 24 — 6y
Ad