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

why is my coin script not working?

Asked by 9 years ago
amnt = 1
function onTouched(part)
    local h = part.Parent:findFirstChild("Humanoid")
    if (h~=nil) then
        local thisplr = game.Players:findFirstChild(h.Parent.Name)
        if (thisplr~=nil) then
            local stats = thisplr:findFirstChild("leaderstats")
            if (stats~=nil) then
                local score = stats:findFirstChild("Shiny Objects)")
                if (score~=nil) then
                    score.Value = score.Value + amnt
                end
            end
        end
        script.Parent:remove()
    end
end

script.Parent.Touched:connect(onTouched)

That is my coin script

function onPlayerEntered(newPlayer)
    wait(.5)
    local stats = Instance.new("IntValue")
    stats.Name = "leaderstats"
    local weaponsBackpack = Instance.new("StringValue")
    weaponsBackpack.Name = "Weapons"


    local cash = Instance.new("IntValue")

    cash.Name = "Shiny Objects"
    cash.Value = 0

    cash.Parent = stats

    stats.Parent = newPlayer
    weaponsBackpack.Parent = newPlayer

end

game.Players.ChildAdded:connect(onPlayerEntered)

thats my leaderboard

0
Btw im not good with LB so i used free scripts D: hiimcool34 0 — 9y
0
So whats wrong with the script? Teeter11 281 — 9y
0
There is a ) inside of ("Shiny Objects)") TofuBytes 500 — 9y
0
Thank you! hiimcool34 0 — 9y

Answer this question