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

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question