Add a simple part into the Workspace. Inside that part add a ClickDetector. Inside that ClickDetector add an IntValue and a Script.
Now write this in the script:
script.Parent.MouseClick:connect(function() local X = script.Parent.Value.Value if X == 1 then X = X + 1 end end)
I thought this would add 1 to the IntValue the first time you click the part, but it doesn't. Why not?
The problem is the variable. Since the variable is property it becomes sort of "read only". You can't change the property through the variable X
. You may change the ObjectValues's property if it's a variable. So that means that you can do this:
script.Parent.MouseClick:connect(function() local X = script.Parent.Value --Object Value if X.Value == 1 then --script.Parent.Value.Value is "1" then... X.Value = X.Value + 1 --script.Parent.Value.Value = script.Parent.Value.Value+1. end end)
Locked by EzraNehemiah_TF2 and BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?