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

Auto StarterGear Weapon Save? Any help?

Asked by 9 years ago

Im trying to get together a script that will save "ONLY" the weapons that go into StartGear. There are shops that when you buy the item it goes into StarterGear. However when I leave the server and come back it does not remember that I purchased it...

This is the script

local wm = Instance.new("Model")
wm.Name = "Weaps"

function give(weap, player) 

    for _, w in ipairs(player.Weaps:GetChildren()) do
        if w.Name == weap.Name then return end
    end

    for _, w in ipairs(game.StarterGear:GetChildren()) do
        if w.Name == weap.Name then return end
    end

    weap:clone().Parent = player.Weaps
end

game.Players.ChildAdded:connect(function(p)
    wm:clone().Parent = p
    wait()
    p.Character.ChildAdded:connect(function(wep)
        if wep.className == "Tool" then
            give(wep, p)
        end
    end)
    p.Changed:connect(function(pr)
        if pr == "Character" then
            for _, w in ipairs(p.Weaps:GetChildren()) do
                w:clone().Parent = p.Backpack
            end
            p.Character.ChildAdded:connect(function(wep)
                if wep.className == "Tool" then
                    give(wep, p)
                end
            end)
        end
    end)
    p.Backpack.ChildAdded:connect(function(h)
        if h.className == "HopperBin" then
            give(h, p)      
        end
    end)
end)

0
nothing in this uses data persistence to transfer between servers. HungryJaffer 1246 — 9y
0
... CarterTheHippo 120 — 9y

Answer this question