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

How could I move this localscript over to a normal script? (And still have it functional) [closed]

Asked by 8 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
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)

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?

2 answers

Log in to vote
0
Answered by 8 years ago

You cant, LocalPlayer is LocalScript only.

0
To have it still functional, it may need some edits. Examine the question a little more. rexbit 707 — 8y
Ad
Log in to vote
0
Answered by
Valatos 166
8 years ago
Edited 8 years ago

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