Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I made a IntValue, and when you touch a brick its supposed to add by 1. What did I do wrong?

My second time posting today lol, anyways. I am trying to make a cash value add by +1 every time you touch a brick but I just get a error. Here is the coding

local debounce = false
local amount = 1

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounce then
			debounce = false
			wait(14)
			debounce = true
			local cash = hit.Parent.Parent:WaitForChild("Cash")
			cash.Value + amount
		end
	end	
end)

The error was: Workspace.Part.Script:12:Incomplete statement: expected assignment or function call.

1 answer

✓ Accepted answer

you need to do cash.Value += amount which is the same as cash.Value = cash.Value + amount

This discussion is preserved as it was. New answers, comments, and votes are closed.