**So the issue i am getting here is : ** Workspace.TycoonModel.MainItems.ConveyorBelt.CollectorPart.Script:5: attempt to perform arithmetic (add) on nil and number
and this is the code which i have typed:
local CashValue = script.Parent.Parent.Parent.Parent.Values.CashValue
script.parent.Touched:Connect(function(Hit) if Hit.Name == "Part" and Hit:FindFirstChild("CashValue") then CashValue.Value += Hit:FindFirstChild("CashValue").Value Hit:Destroy() end end)
What I am trying to do is to destroy a part which is dropped by the dropper that touches the white shining plate and the end of the conveyor belt, and add cash into the cashvalue.
I will really, REALLY appreaciate all help!
ThankYOU!!
i tryed my best
1 | local CashValue = script.Parent.Parent.Parent.Parent.Values.CashValue |
2 |
3 | script.Parent.Touched:Connect( function (Hit) |
4 | if Hit.Name = = "Part" and Hit:FindFirstChild( "CashValue" ) then |
5 | CashValue.Value + = Hit:FindFirstChild( "CashValue" ).Value |
6 | Hit:Destroy() |
7 | end |
8 | end ) |