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)
You cant, LocalPlayer is LocalScript only.
You could try to use this, the only thing You have to do is add Parents to the "local p" cause i don't know exactly where the button is located, i made it so it fits into a [Script > Frame(Or button) > Gui > PlayerGui > Player]
local Count -- Later used local Stuff = game.ReplicatedStorage:GetChildren() script.Parent.MouseButton1Click:connect(function() -- Clicker is actually the person that clicks local p = script.Parent.Parent.Parent.Parent -- As i see mousebutton1click function i see its a gui, that --means that you could do [script.Parent.Parent.Parent] to reach the player itself you may need --to add more .Parents to it cause i don't know the exact location of the player -- And i see you want 3 random objects to clone, that can more easy repeat Count = Count +1 Stuff[math.random(1,#Stuff)]:Clone().Parent = p.Backpack until Count == 3 end)
Hope this works for you :D if it doesn't work for you, feel free to message me that :P
Closed as Not Constructive by rexbit, koolkid8099, and BlueTaslem
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?