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

Making a border game and I tried to make a click-to-pick. Why won't it work?

So I'm making a border game and I'm currently making it so clicking a passport or permit causes it to go in your inventory. I started off with the permit and it oddly won't work, the permit is a model so I don't get confused or something stupid and it's three parts. If it's the script then please help me fix that.

Script:

local Permit = script.Parent local click = Permit.ClickDetector

local function pickup(player) local newTool = Instance.new('Tool') newTool.Name = 'Permit' local handle = part:Clone() handle.Name = 'Handle' handle.Parent = newTool handle.Script:Desroy() newTool.Parent = game.Workspace:FindFirstChild(player.Name) end

click.Mouseclick:Connect(pickup())

1 comment

0

Study the fundamentals. You clearly lack basic scripting knowledge and it shows.

2 answers

You should connect the function by calling it, you did :Connect(pickup())

Just do:

click.Mouseclick:Connect(pickup)

1 comment

0

Sadly, that didn't make a difference. :(

Here's how I would do it...

local Permit = script.Parent
local click = Permit.ClickDetector

local part = workspace.Part --make a part that you can clone

click.Mouseclick:Connect(function(player)
	local newTool = Instance.new('Tool')
	newTool.Name = 'Permit'
	local handle = part:Clone()
	handle.Name = 'Handle'
	handle.Parent = newTool
	handle.Script:Desroy()
	newTool.Parent = game.Workspace:FindFirstChild(player.Backpack)
end)

Why don't you just pre-make the tool tho if I may ask?

1 comment

0

When you say pre-make, do you mean "make it yourself"?

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