-1

Pls help me with this? I will really be thankful!

**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!!

0
Change script.parent to script.Parent because .parent with small "p" won't work and will error. T3_MasterGamer 1047 — 14d
0
Im assuming the value property of CashValue is returning nil. Make sure that the CashValue Instance is a integer value, number value, etc. and not something like an object value. JustinWe12 719 — 13d

0

i tryed my best

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)