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

Would this work? (Cloning weapons once Player dies script)

Asked by 11 years ago

How can I make it so if someone buys a weapon using In game currency at my dialog shop that if they die they keep it? Could this script part below work if I add the locals and such? Also is this part correct as a body of the script ( I will declare the locals and more ) if Player.Health = 0 then Weapon1.ReplicatedStorage.Clone() Well I could use some tips to make this script work. Thank you.

2 answers

Log in to vote
0
Answered by 11 years ago

insert a script and put in workspace, when you die, you will respawn with your tools

01function saveWeapons(player)
02    local bin = Instance.new("HopperBin")
03    bin.Parent = game.Lighting
04    bin.Name = player.Name
05    local stuff = player.Backpack:GetChildren()
06    for i = 1,#stuff do
07        local name = stuff[i].Name
08        if game.StarterPack:findFirstChild(name)==nil then
09            stuff[i]:Clone().Parent = bin
10        end
11    end
12    local char = player.Character:GetChildren()
13    for i = 1,#char do
14        if char[i].className == "Tool" then
15            local name = char[i].Name
View all 52 lines...
0
Thanks! coldice231 45 — 11y
0
My only problem is that my game has a lobby and I don't want people killing in the lobby. coldice231 45 — 11y
Ad
Log in to vote
4
Answered by 11 years ago

Place the gear into the Player's StarterGear and into their Backpack when they purchase the gear. After that, they will spawn with the gear every time until they leave.

0
Like clone it into their StarterGui? coldice231 45 — 11y
0
No, clone it into the Player's Backpack when they first buy it, and also clone it into the Player's StarterGear when they first buy it. They will then spawn with that gear every time. Articulating 1335 — 11y

Answer this question