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

Can someone help me make a local script that allows you to pick up an item into your backpack?

Asked by 6 years ago
Edited 6 years ago

The local script is in clickdetector.

local log = game.Workspace.Model

local clickD = script.Parent

local player = game.Players.LocalPlayers

local function MoveToInv()

local copylog = log:Clone()

copylog.Parent = player.Backpack

end

clickD.MouseClick:connect(MoveToInv)

This do not work, I don't know why...

0
ClickDetectors return an argument, that which is the player. (function (player) -- end) TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I tried making this work in a local script but I could not do that but this does work in a normal script inside a click detector

local ObjectToPickUp = game.Workspace.Item -- Change item to the name of your item

script.Parent.MouseClick:connect(function()
    ObjectToPickUp:Clone()
    ObjectToPickUp.Parent = game.Players.LocalPlayer.Backpack
end)
0
Ok, I think the problem is the local script is supposed to be just a script, gotcha! GloBoySo300 0 — 6y
0
It says that the "plr" is a nil value, help. GloBoySo300 0 — 6y
0
I am not sure how to fix nil values MasonTheCreeperYT3 74 — 6y
Ad

Answer this question