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("Cash")
				   cash.Value = cash.Value + 250
           end
end
db = 0
end
end


script.Parent.Touched:connect(onTouched)

Hello, so ive been working on a "money while driving" (think Vehicle Simulator) but it says that owner ~~~~~~~~~~~~~~~~~ local owner = script.Parent.Parent.Parent.Parent.Parent.Name

says that owner is nil, how would i fix that? mainly, how would i figure out a driver of a car? 

Thanks for stopping by!

Edit; the script is under the driver seat, so the parent of this script is driver seat

2 comments

0

What's this script parented under and their ancestors? Show the explorer so i can get a reference

0

oh, its under the drivers seat