Im not sure why im getting this error below in my extra cash script.
"Workspace.$150 CASH!.Head.Money Giver:12: attempt to index local 'player' (a nil value)"
the error is for line 12
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
Its the script below.
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
local humanoid = hit.Parent:findFirstChild("Humanoid")
if ("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney ~= nil then
cashmoney.Value = cashmoney.Value +150
wait(.1)
script.Parent.Parent.Name = "1 min"
wait(30)
script.Parent.Parent.Name = "30 sec"
wait(30)
script.Parent.Parent.Name = "$150 CASH!"
end
end
ting = 0
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Im not sure why it spaced down like that, its not like that in the script.