Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

ClickDetectors return an argument, that which is the player. (function (player) -- end)

1 answer

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)

3 comments

0

Ok, I think the problem is the local script is supposed to be just a script, gotcha!

0

It says that the "plr" is a nil value, help.

0

I am not sure how to fix nil values

This discussion is preserved as it was. New answers, comments, and votes are closed.