Hello! I have a script that is supposed to give you money each second you drive, but it isn't exactly working.
script.Parent.Touched:connect(touch)
function touch(hit)
local character = hit.Parent
local stats = hit.Parent:findFirstChild("leaderstats")
local player = game.Players:GetPlayerFromCharacter(character)
local add = 110
wait(1)
if character.HumanoidRootPart and script.Parent.SeatWeld then
print("Player sitting")
if script.Parent.Throttle == 1 then
wait(1)
local cash = stats:findFirstChild("Money")
cash.Value = cash.Value +add
end
end
end
script.Parent.Touched:connect(touch)
It prints the player sitting message, but then comes up (and doesn't refer to any line in any script) saying attempt to call a nil value. Any ideas why it won't work? I have a leaderboard with a money section and everything.

2 comments
Try putting a space inbetween add and the +
@drew1017 1) If you're giving an answer, post an answer, not a comment. 2) Only under very rare circumstances does Lua care about white-space. While the code here could be spaced a lot better, that's only for the HUMANS dealing with it.