Cloning a tool breaks local Script?

Hi there, I have a local script inside a weapon and when you put that tool into the starter pack everything is working fine with the It. But what I’m trying to do is replace their old gun with a new gun that has a different model. so I destroyed there old tool that was inside the character and put the new tool inside the player backpack. but when I pull the tool out the local script that was inside the does not fire when the character equips the gun. to rap it up when I put the gun in starter pack it works fine but when I clone it into the character is breaks. Thank you for reading and do you have any suggestions?

--this is a server script inside the old tool 

script.Parent.Equipped:Connect(function()
	tool = script.Parent
	char = script.Parent.Parent
end)



game.ReplicatedStorage.RemoteFunctions.Weapons.Twin.OnServerEvent:Connect(function(plr)
	 if char:WaitForChild("Stats").Level.value >= 15 and plr.PlayerGui.Upgrades.UpgradesL15.Upgraded.Value == false then
		game.ReplicatedStorage.RemoteFunctions.StopAnimation:FireClient(plr)
		wait(.2)
		local Twin = game.ServerStorage.Weapons.Twin:Clone()
		Twin.Name = "Twin"
		Twin.Parent = plr.Backpack
		tool:Destroy()
	end
end)

------the below script is a local script inside the tool in trying to clone----

script.Parent.Equipped:Connect(function(tool)
	print("hi") --does not print but is in the tool 
end)

Refreshing Tools


Consider an alternative method:

  • Place a duplicate model inside ServerStorage.
  • Destroy previous model.
  • Clone the duplicate model.
  • Parent the new clone to the backpack.

If you have certain stats on the tool, make sure that you can handle the stats from server; do not save the stats inside the tool.

Ill be trying this out soon ill get back to you on the results

There’s not quite enough information on this thread. Here are some things missing:

  • Implementation (the code you’re working with)
  • Locations (where your scripts are, what type of scripts they are)
  • Errors in the console (F9, screenshot errors related to your code if there are any)

Without these, it’s somewhat hard to address your problem adequately.

Are you destroying the actual Tool instance, or are you deleting parts of the Tool and replacing them? If you’re doing the former, then it’s most likely a problem with the way you’re cloning it over. If it’s the latter, then you’ll need to address your code so that it’s interchangeable with multiple models.

I have posted the code and also putting it in server storage did not help

I’m not sure if the code for the Equipped event and the remote are two separate scripts, but if they aren’t, that’s one problem to address - you can’t access ServerStorage from a LocalScript, nor can you use FireClient on the client.

Checking your console would’ve helped you identify these issues.

this is a server script and no errors are in console

so does cloning a tool into the character make the local script not work???

sry is was my fault for the first gun i was waiting for the character it load but once i replicated it was still trying to wait till loaded and never did