I'm wondering if you guy could guide into the correct path of categorizing my weapons in groups like "Primary" and "Secondary" so it could be easier to go about making a code that would allow the user to have only one of each category. I would also like to know how what I would have to add into my script
local ToolPickup = game.Lighting.ToolPickup ToolPickup.OnServerEvent:Connect(function(Player) game.Lighting.Uzi:Clone().Parent = Player.Backpack game.Workspace.Part:Destroy() end)
so it would make that if the player already has a one primary and secondary, he would have to trade the previous gun in that category to pick up the new one.
I'm actually in the middle of working on the same thing
On your server side script do this
local ToolPickup = game.Lighting.ToolPickup ToolPickup.OnServerEvent:Connect(function(Player, identtype) local uzi = game.Lighting.Uzi:Clone() uzi.Parent = Player.Backpack local plr = player.Character plr.Humaoind:UnequipTools() for x, v in next, player.Backpack:GetChildren() do if v:FindFirstChild(identtype) ~= nil then v:Remove() end end local ident = Instance.new("BoolValue", uzi) ident.Name = identtype game.Workspace.Part:Destroy() end)
On your local side script do this and change "Primary" to the type of weapon you want it to identify as
--Other parts of your script game.Lighting.ToolPickup:FireServer("Primary") --Other parts of your script