Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to perform arithmetic (add) on nil and number?

Asked by 2 years ago

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)

0
What are you trying to do with the script? Please don't just provide the script, we need explanation on what you're trying to do as well. NotThatFamouss 605 — 2y
0
im trying to make a tycoon and im trying to make the blocks disappear when they touch the sell zone at the end to give you money SyconicLonic 6 — 2y

1 answer

Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
2 years ago

You forgot to add a number, that's all I guess

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 += 1 -- Change 1 to the number of cash you want to give
Hit:FindFirstChild("CashValue").Value Hit:Destroy() 
end 
end
Ad

Answer this question