For some reason, tools that have changed parents don't replicate onto the server?

Hi everyone!

This is a bit of a confusing and frusturating issue, so here it out:

Whenever I transfer an item from the Backpack to the InventoryFolder, it does it fluently on the client. However, when I go into client view, it didn’t even change at all, and it’s just… there.

I’ve tried “cloning the tool and removing the original tool”, but that came with the same results.

Here’s some screenshots to explain it:
Screenshot (645) Screenshot (646)

I’m absolutely certain that the tools aren’t cloned / parented on the client, it’s all done on the server.

Here’s my code that is involved with it:

local function keyPress(keyCode)
	if keyCode.keyCode == Enum.KeyCode.H then
		local toolEquipped = character:FindFirstChildOfClass("Tool")
		if toolEquipped then
			print('yeah')
			
			local response = remote:InvokeServer(toolEquipped)
			humanoid:UnequipTools()
		end
	end
end
userInputService.InputBegan:Connect(keyPress)
-- The script above is the client side for y'know, storing stuff.

--- This is the server-sided code.
local function onGiveEvent(player, itemName)
	local inventory = player:WaitForChild("Inventory")
	local itemFound = game.ReplicatedStorage.Tools:FindFirstChild(itemName)
	if itemFound and inventory:FindFirstChild(itemName) then
		itemFound.Parent = player.Backpack
		print(itemFound.Parent)
		
		return true
	elseif not itemFound or not inventory:FindFirstChild("ItemName") then
		antiCheatMessage(player)
	end
end

local function onStoreEvent(player, item)
	local inventory = player:WaitForChild("Inventory")
	if item then
		item.Parent = inventory
		return {true, item}
	else
		antiCheatMessage(player)
	end
end

storeEvent.OnServerInvoke = onStoreEvent
giveEvent.OnServerInvoke = onGiveEvent

Any help is appreciated! :slight_smile:

1 Like

For future reference you should also post any code that could be causing your issue. There is literally an infinite amount of ways how you’re distributing tools to players and we won’t be able to help with much because how broad your problem is.

1 Like

Oh right! Almost forgot. Thanks for reminding me!

2 Likes

From a glance I can guess that you are moving them with a local script.

The local scripts effects will only be visible to the client and the server. I’m not sure about when a player choses to equip a tool if it would look like this or replicate.

Try it with a normal script and it should replicate.

1 Like

I’ll see if I did any of that funny replicating business on the client. Thanks for replying!

2 Likes

Should have glanced harder. He’s firing a remote to the server that handles replicating tools.

I looked prior to the edit that added to the script.
Sorry if this causes any confusion.

Have you been able to narrow down what function isn’t working? It looks like both onGiveEvent and onStoreEvent handle moving a tool into a players inventory. Right off the bat I can’t really see what would be causing your tools not to be replicated.

Alright, I’ll look into that. I sure do hope that it fixes the problem :slight_smile:

Nope, couldn’t find anything wrong… I think this is some kind of new ROBLOX security feature???

Okay so I found the problem, let me break it down:

Apparently I was looking for the wrong thing the entire time for the ItemFound variables! I was actually supposed to look for them in the Inventory and Backpack!!!

Thanks for helping guys, it really helped me to the right area to look at! :)))))

2 Likes