Ive been having trouble with this script for so long and i dont know how to fix it since im so new to scripting can somebody please tell me how to fix it.

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

function give(weap, player) 
	--return if they allready have a copy
	for _, w in ipairs(player.Weaps:GetChildren()) do
		if w.Name == weap.Name then return end
	end
	--return if the weaps is a startpack one
	for _, w in ipairs(game.StarterPack:GetChildren()) do
		if w.Name == weap.Name then return end
	end
	--add it to thier weapons
	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)
	

8 comments

0

If you can, clone the gear to StarterGear which is located in the player

0

how do i do that can you show me?

0

is player.Weaps a folder or did you rename the backpack?

0

player.weaps is a model

0

nvm i think i fixed it

0

nope its not fixed pls help

0

IT WORKED THX OS MUH