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 Number and Instance?

Asked by 2 years ago

I had a script in which every 10 seconds it awards you money but it errors saying "attempt to perform arithmetic (add) on number and Instance"

while true do
                wait(10)
                Players:WaitForChild(script.Parent.Parent.Parent.OwnerName.Value).leaderstats.Cash.Value = Players:WaitForChild(script.Parent.Parent.Parent.OwnerName.Value).leaderstats.Cash.Value + script.Parent.Handle.Worth 
            end

I tried changing it to tostring() but no it did not work.

1 answer

Log in to vote
0
Answered by
Borrahh 265 Moderation Voter
2 years ago

I'm assuming that

script.Parent.Handle.Worth

is a String/Int Value? If so try the following

while true do
                task.wait(10)
                Players:WaitForChild(script.Parent.Parent.Parent.OwnerName.Value).leaderstats.Cash.Value += script.Parent.Handle.Worth.Value
            end
Ad

Answer this question