p = game.Players.LocalPlayer
repeat wait() until p:FindFirstChild("Backpack")
function Click()
wait(2)
repeat wait() until p:FindFirstChild("Backpack")
game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
end
script.Parent.MouseButton1Click:connect(Click)
--// Put your code in a code block. Blue button in code editor. Code in between, all that, yeah.
This is in a localscript inside of a textbutton. When the weapons are given to the player, over half of them don't work, and it only happens to players are given the weapons by this script.

1 comment
You need to learn how to use WaitForChild.