script so far:
local player = game.Players.LocalPlayer points = player.leaderstats.Coins local product = ".300 Carbine" local prodlocation = game.ServerStorage.NewWeaponStache.Carbines -- remember to change this last part later ----------------------------------------------------------------------------------------- function activate() if points >= script.Parent.Parent.Price.Text then prodlocation:Clone().Parent = player.Backpack prodlocation:Clone().Parent = player.StarterGear end end script.Parent.MouseButton1Click:Connect(activate)
but when the weapon gets put into the players inventory, how do i check before that (overexaggeration) so the player can freely switch their weapons without overload of like 58+ weapons
I don't know if this will work, I will test it when I have a chance later. And this should basically like replace the item that is already in the players backpack with the item they bought.
local player = game.Players.LocalPlayer points = player.leaderstats.Coins Tool = false local product = ".300 Carbine" local prodlocation = game.ServerStorage.NewWeaponStache.Carbines -- remember to change this last part later ----------------------------------------------------------------------------------------- function activate() if points >= script.Parent.Parent.Price.Text then If Tool = false then prodlocation:Clone().Parent = player.Backpack prodlocation:Clone().Parent = player.StarterGear Tool = true Elseif points >= script.Parent.Parent.Price.Text then If Tool = true then local tool = playet.Backpack:GetChildren If tool then tool:Destroy Tool = false prodlocation:Clone().Parent = player.Backpack prodlocation:Clone().Parent = player.StarterGear Tool = true end end script.Parent.MouseButton1Click:Connect(activate)
Once again this is by guess. So I will get on pc in few and check. And if it doesn't work, I will make sure to make a work in script
Otherwise if just wanting to check for a tool like you asked. You can create a for loop checking for tools within in the player constantly.
for _,v in pairs(player.Backpack:GetChildren()) do if v:IsA("Tool") then -- finds tool or tools -- script whatever happens after a tool is found end end