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())
You should connect the function by calling it, you did :Connect(pickup())
Just do:
click.Mouseclick:Connect(pickup)
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?