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

Why does this local script break certain weapons?

Asked by 7 years ago

I have this code that assigns random weapons to a player from replicated storage, and it assigns the weapons just fine. Certain weapons however, just completely break when assigned. The weapons work perfectly fine until given through this script. Any help would be greatly appreciated, i've been trying to figure this out for about two weeks now.

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)

``

Script location:

game.Workspace.Cstand2.Popup GUI.Classes.Main.Gambler.RandomWeapon

Answer this question