I was wondering if it was possible to add one number to a attribute each time you use a tool. I try to do this but I can’t because of this red error underline the plus:
Is this possible?
I was wondering if it was possible to add one number to a attribute each time you use a tool. I try to do this but I can’t because of this red error underline the plus:
Is this possible?
local Tool = script.Parent
local IncreaseNumber = 0
Tool.Activated:Connect(function()
local Character = Tool.Parent
Character:SetAttribute("Test", IncreaseNumber)
IncreaseNumber += 1
end)
You can so something like this, The “IncreaseNumber” will go up every time the tool is being used
On occasions where you don’t want to pollute the namespace you can do the following.
Character:SetAttribute("Value", (Character:GetAttribute("Value") or 0) + 1)