Tool breaks after i clone it

Hello, i’m a small roblox developer that is still learning how to script

I have an unboxing system that works fine until you claim the item (the item is a tool)
When the player opens the crate i randomly pick a tool from a Tools folder inside ReplicatedStorage. When the tool is chosen i clone it and parent it to the players Backpack, BUT the tool scripts completely break. This seems to happen every time i try to clone a tool and try to parent it to the players Backpack. I tried disabling the scripts and enabling them when the tool gets parented to the players Backpack but it doesn’t work.

It’d be nice if someone could help me with this problem (Please if you can help give a simple answer and not something complicated.)

1 Like

May you show us your script so we have a better understanding of what you are doing?

1 Like

The tools are the same, so the scripts must be the same too. The scripts don’t know what tool is being used, due to them being cloned. Make each script unique to their tools.

And you are sure the scripts are inside the tools?

Screenshot_6

So what is the tool script actually meant to do?

play a slash animation and do damage to the player, but when i clone it it just breaks.
Weld script also breaks.

ok, may I see the script that does this?

It looks like you’re trying to clone the tool in a LocalScript.

  1. With FilteringEnabled, instances created or cloned on the client won’t replicate to the server, so you need to clone the tool in a Script.
  2. Your code tries to change the original tool’s parent and doesn’t actually clone it.
2 Likes

yes, you need to do
clone = tool:Clone()
clone.Parent = Player.Backpack

local Item = ItemsHolder[Tool]:Clone()
Item.Parent = game.Players.LocalPlayer.Backpack

You forgot to clone it, meaning no one else in the game can access it.

Yeah my bad i got it to clone but the tool is still broken after, when the tool is inside StarterPack it works fine. Only breaks when i try to parent it to the players Backpack.

can I see the script which it uses?

the script that is inside the tool?

yes, the one that plays the animation and damages the other player

the long line that was cut off:
if game.Players:FindFirstChild(HUM.Parent.Name) and FRIENDLYFIRE.Value == false and TOUCHED.Parent:FindFirstChildOfClass(“ForceField”) == nil then

That’s very long and complicated, I recommend adding print statements so you can find out what runs properly and what doesn’t run