Im making a simple tycoon and for the droplets that fall from the dropper, they have a numberValue of 1. The collector also has a numberValue, when the droplets fall on the collector the collecotr's script is supposed to add the value of the droplet to itself but i keep getting an error
Code
script.Parent.Touched:Connect(function(hit) local coin = game.Workspace:WaitForChild("coin") if hit == coin then script.Parent.Value += 1 end end)
error
Workspace.Collector.Script:4: attempt to perform arithmetic (add) on Instance and number
from what it seems, Value is a NumberValue. If that's the case you should do:
script.Parent.Value.Value
instead of
script.Parent.Value
your error probably occurred because Value (the numbervalue itself) is an instance and Value (the property) is a Number