Here is a short example, this script won't work and I can't figure out why:
local a = script.Parent.Value.Value script.Parent.Touched:connect(function(hit) if hit.Name == "cho" then a = a + 1 wait() end end)
the value won't increase no matter how many times "cho" touches the Part with the script.
I also had this problem. To put it simply: you cannot write to a variable that is assigned to a property.
Instead of this...
x = game.StarterGui.Gui.Frame.Text x = "Hello"
Do this...
x = game.StarterGui.Gui.Frame x.Text = "Hello"
Likewise,
local a = script.Parent.Value script.Parent.Touched:connect(function(hit) if hit.Name == "cho" then a.Value = a.Value + 1 wait() end end)
Your problem is that you can't add your number value's value in a variable,
local a = script.Parent.Value script.Parent.Touched:connect(function(hit) if hit.Name == "cho" then a.Value = a.Value + 1 wait() end end)