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 8 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.

01p = game.Players.LocalPlayer
02repeat wait() until p:FindFirstChild("Backpack")
03function Click()
04    wait(2)
05repeat wait() until p:FindFirstChild("Backpack")
06game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
07game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
08game.ReplicatedStorage:GetChildren() [math.random(1, #game.ReplicatedStorage:GetChildren())]:clone().Parent = p.Backpack
09end
10 
11script.Parent.MouseButton1Click:connect(Click)

``

Script location:

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

Answer this question