I need script, which getting money while you driving. Whats wrong?
local db = 0
function onTouched(hit)
if db == 0 then
db = 1
local owner = script.Parent.Parent.Parent.Parent.Parent.Name
local user = game.Players:findFirstChild(owner)
local stats = user:findFirstChild("leaderstats")
while true do
wait()
if script.Parent.Throttle == 1 then
wait(1)
local cash = stats:findFirstChild("Money")
cash.Value = cash.Value + 5
end
end
db = 0
end
end
script.Parent.Touched:connect(onTouched)
######Edited ~ format & tab your code correctly!

1 comment
local db = 0 function onTouched(hit) if db == 0 then db = 1 local owner = script.Parent.Parent.Parent.Parent.Parent.Name local user = game.Players:findFirstChild(owner) local stats = user:findFirstChild("leaderstats") while true do wait() if script.Parent.Throttle == 1 then wait(1) local cash = stats:findFirstChild("Money")