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

How do I implement a "equip different knife" script into a default knife script?

Asked by
Cactj -2
8 years ago

My plan is to be able to have a shop GUI and an inventory GUI. But, I don't want the person to have 2+ knives: the default knife + the boughten ones. I also need to do this with the gun.

Here is the code I use to give the killer and the sheriff their weapons.

            local backpack = player:FindFirstChild("Backpack")
            if backpack then
                if player == bloxxer then
                    local sword = serverstorage:WaitForChild("Sword"):clone()
                    sword.Parent = backpack
                    event:FireClient(player, "Class", "Bloxxer")

                    local mydata = playerdata[player.userId]
                    if mydata and mydata.emeraldsword == 1 then
                        local emeraldswordvalue = sword:FindFirstChild("EmeraldSword")
                        if emeraldswordvalue then
                            emeraldswordvalue.Value = true
                        end
                    end

                elseif player == sheriff then
                    local netgun = serverstorage:WaitForChild("Gun"):clone()
                    netgun.Parent = backpack
                    event:FireClient(player, "Class", "Sheriff")
                else
                    event:FireClient(player, "Class", "Bystander")
                end
            end
        end
    end
end
spawnsmodel:remove()

Any help would be great.

Answer this question