Tool doesn't work when cloned from ReplicatedStorage

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    Clone tool and put into players backpack.

  2. What is the issue?
    When the tool is cloned and in the players backpack the scripts inside it won’t work. Like .Activated()

  3. What solutions have you tried so far?
    I’ve searched around and it doesn’t seem like people are having this issue

Local: or i, itemButton in pairs (InventoryGui.ItemBackground.Frame:GetDescendants()) do
	if itemButton:IsA("ImageButton") then
		itemButton.MouseButton1Up:Connect(function()
			if script.Parent.Parent.Chest.Enabled == false then
			script.Parent.Picked.Value = itemButton
			itemButton.Parent.Visible = false
			game.ReplicatedStorage.EquipPickup:FireServer(itemButton.Parent.Name)
			else
			game.ReplicatedStorage.Chest:FireServer(chest, itemButton.Parent)
			end
		end)
	end
end

Server:
game.ReplicatedStorage.EquipPickup.OnServerEvent:Connect(function(player, itemButton)
	if curHotbar < maxHotbar then
		curHotbar = curHotbar + 1
		local tool = game.ReplicatedStorage.Tools:FindFirstChild(itemButton):Clone()
		tool.Parent = player.Backpack
	end
end)

7 Likes

It could be because you are using :GetDescendants() which is probably not what you want. You would want to use :GetChildren() in this case.

for i, itemButton in pairs(InventoryGui.ItemBackground.Frame:GetChildren()) do
2 Likes

That won’t really change the way the tool is cloned. The tool clones into the players backpack already. I’m trying to figure out why when the tool is cloned the .Activated() function in the tool won’t work but when I put it in StarterPack it works fine. I’ll try it though. Thanks for responding :slight_smile:

3 Likes

Try having the Script inside the Tool Disabled and Enable it via the ServerSide.

2 Likes

I tried it and it sadly didn’t work. Thanks for responding :slight_smile:

3 Likes

I would just put your tool into a folder in the workspace and clone it from there so I know that it is being cloned in the correct format.

2 Likes

Does the Tool have a Handle and RequiresHandle set to true? If not the Actived Event will not work.

2 Likes

You also might want to make a localscript and say:

                 Tool.equipped:connect(function(mouse)


  mouse.button1down:connect(function()

     —your code in here...
end)
end)
2 Likes

Yeah the tool has a handle and requiresHandle is set to true

2 Likes

Still doesn’t work. Im not sure if it has to do with the custom Hotbar I made ill get rid of that and see if that works.

2 Likes

This probably isn’t your hotbar. I have had this same problem too many times.

I usually fix my problem by calling functions in a localscript rather than a server script.

2 Likes

I removed the hotbar and made it the default hotbar and it still doesn’t work.

1 Like

Can you provide us with the code inside the Tool?

1 Like
script.Parent.Activated:Connect(function()

print("f")

end)```
1 Like

Is that the entire code inside the script? If not I recommend posting the entire code.

Yes it is the entire code. I made it simple just to see if it would work.

Is ManualActivationOnly set to false? If not Tool.Activated will only work if Tool:Activate is called.

ManualActivationOnly is set to off.

Then this should work, is there any errors?

Nope there are no error. Nothing happens.