Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Give cash when touched?

Asked by 9 years ago

Changed orginale script! Because i needs ServerScriptService and not workspace. Do you guys help me to fix it?

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 cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) 

        if cashmoney ~= nil then  
        cashmoney.Value = cashmoney.Value + 250
        end

    end

    ting = 0 
    end
end

script.Parent.Touched:connect(onTouched) 

1 answer

Log in to vote
1
Answered by 9 years ago

Line 11 - You use a nil value Change the 'player' to 'user' in line 11

0
Thanks :) minetrackmania 186 — 9y
Ad

Answer this question