Cloned tools don't work when sent through a remoteevent

I’ve been having this issue for a long time and I have yet to find an actual solution to this problem I’m having. In the code below, an item is crafted which sends a remoteevent to a serverscript. Crafteditem is a value that is listed as the name of whatever you crafted (Flail, Sword, etc)

game:GetService("ReplicatedStorage"):WaitForChild("Remotes").CraftItem.OnServerEvent:Connect(function(player, crafteditem)
	local tool = game:GetService("ReplicatedStorage"):WaitForChild(crafteditem) --searches replicatedstorage for tool by waiting for its name
	wait()
	
	tool:Clone().Parent = player.Backpack --clones it to backpack.
end)

When the tool is cloned to the player backpack nothing works. I can equip the tool and such its just the local and serverscript inside of it don’t work. Requireshandle is on btw. Please, if you’ve had this problem and have found a solution please share it with me.

First of all, it is not safe to put important stuffs in ReplicatedStorage. Put it in ServerStorage instead.

Second, your code seems fine, can you just tell us the error you’re receiving?

I faced the same problem while I was working on a shop GUI for my game. The tools did not work, But I found a fix for this:

  1. I created a folder named “Tools” to store all the tools in Replicated Storage

  2. I created a remote event in the Replicated Storage named “Buy”

  3. I created a TextButton which controls the purchase in a ScreenGui in StarterGui

Here are the scripts:

The local script which fires the RemoteEvent (Inside the TextButton):

-- Client(LocalScript)
local RemoteEvent = game.ReplicatedStorage.Buy -- Your RemoteEvent location (put in ReplicatedStorage the RemoteEvent)

script.Parent.MouseButton1Click:Connect(function() -- On click in mouse
	RemoteEvent:FireServer("ToolName") -- Fire remote event sending the tool name
end)

Buy script inside the ServerScriptService:

-- Server
local RemoteEvent = game.ReplicatedStorage.Buy -- Your RemoteEvent location (put in ReplicatedStorage the RemoteEvent)
local tools = game.ReplicatedStorage.Tools -- Tools folder

RemoteEvent.OnServerEvent:Connect(function(player,toolName) -- Get player and toolName
	local Backpack = player:FindFirstChild("Backpack")
	local StarterGear = player:FindFirstChild("StarterGear")
	if Backpack and StarterGear then -- If find Backpack and StarterGear
		local tool = tools:FindFirstChild(toolName)
		if tool then -- If find the tool
			tool:Clone().Parent = Backpack -- Clone tool to Backpack
			tool:Clone().Parent = StarterGear -- Clone tool to StarterGear
		end
	end
end)

This fixed the problem for me.

1 Like

The thing is I’m receiving 0 errors. That’s whats throwing me off so much. Also I put it in replicated storage so the local script can access it, I was experimenting with it and just forgot to change it back xd

The method that @TheAviator2410 is the way to do it. However, make sure to implement checks in the server or exploiters can just fire the remote event and give themselves tools. (Checks such as checking whether the player bought the item would be fine)

Unfortunately this didn’t work and the problem is persisting. Thank you for your comment however.