Tool not working

local Muffin = script.Parent
local ClickDetector = Muffin.Handle.ClickDetector

if Muffin.Handle:FindFirstChild("TouchInterest") then
     Muffin.Handle.TouchInterest = false
end

ClickDetector.MouseClick:Connect(function(player)
     local ToolClone = Muffin:Clone()
     local Handle = ToolClone.Handle
     ToolClone.Parent = player.Backpack
     Handle.ClickDetector:Destroy()
     ToolClone.inventoryScript:Destroy()
     Handle.Anchored = false

When I do this, only the part named handle goes to the players inv

You should put the tool in the players inventory, not just the handle.

1 Like

Like if inside the tool there’s 2 parts for a muffin, the bottom and the top, only the bottom would go to the clone

1 Like

mb i forgot a line, this is the actual code

1 Like

Normally people use meshes if they want more then one part as the tool. Have you tried making a mesh for the muffin? It’s fine if you don’t know how to, as I don’t know how to either lol. I just use a single part instead of two or three.

1 Like

It’s a free model from toolbox

1 Like

If its a free model from the toolbox why would you complain about it not working it is most likely not going to,

2 Likes

What do you want to achieve exactly?

1 Like

all the parts in the tool going into the players tool

1 Like

Is the tool in the starterpack?

i put the tool in the workspace

1 Like

You have to put it into starterpack so players would have it in the inventory.

i scripted it so it clones it and puts it in their inventory

1 Like

Why are you indexing the handle. Just simply clone your tool out of its relative location and parent it to the player’s backpack.

2 Likes

But putting it in the starterpack is easier.

If your trying to make a tool giver put it in replicated storage.

Other wise, do what Amber said.

1 Like

but its for a cafe. when its clicked it goes into the player who clicked it’s inventory, not automaticalyl

1 Like

Then created a part, put a click detection script it, so it would give the player the tool you want it to. Make sure the tool will be a parent of a correct section.

1 Like

wdym, thats not the problem, the problem is that its only putting the part named handle into the players inv, and not the others

I’d try something like making a copy of it and placing it somewhere, and make sure the script you posted is one server script.

local Muffin = script.Parent
local Handle = script.Parent:WaitForChild("Handle")
local ClickDetector = Handle:FindFirstChild("ClickDetector")

if Handle:FindFirstChild("TouchInterest") then
    Handle.TouchInterest = false
end

ClickDetector.MouseClick:Connect(function(Player)
    local Name = "Muffin"
    local Clone = game:GetService("ServerStorage"):FindFirstChild(Name)
    if Clone then
        local v1 = Clone:Clone()
        v1.Parent = Player:FindFirstChild("Backpack")
        for i,v in pairs(v1:GetChildren()) do
                  if v.Handle.ClickDetector then
                        v.Handle.ClickDetector:Destroy()
                        v.inventoryScript:Destroy()
                        v.Handle.Anchored = false
                  end
            end
    end
end)

Maybe you can try it. Not sure if I got what you wanted.

1 Like