When I'm trying to make a script that removes amount of money on touch the money goes to minus (-) when you don't have enough.
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild("money")
cash.Value = cash.Value -100
wait(3)
end
end
ting = 0
end
script.Parent.Touched:connect(onTouched)

3 comments
Do you mean it goes into the negative? Is that not what you wanted it to do? I need you to reword the question.
the ting goes skrrraa
Change 'cash.Value = cash.Value -100' to 'cash.Value = cash.Value - 100'