Firing a Remote Event from a local script

Hey! So I’m making an Inventory System, I followed the tutorial of DeadGambit and modified some stuff to my own liking! Surprisingly, it does work, equipping does work, putting new items into the inventory does work and so on! But I tried to make an unequip button using the tutorial of DeadGambit although his tutorial only had a script of deleting items in the player.Backpack with the same name as the item you’re trying to delete. What I’m trying to do is not that, I want it so it only deletes the ITEM that is the item I’m trying to delete instead of all the items with the same name. so I made some modification on the handle script and remote script I made from his tutorial. Simple Inventory System Part 2 | Handling Different Item Types(2021) - YouTube

You can see in his tutorial there’s a handler script thingy and that’s my LocalScript, there is also a remotes script in his tutorial which I followed and modified a little when I realized it deletes all the items with the same name as you’re trying to delete (UNEQUIP FROM BACKKPACK)

local plr = game:GetService("Players").LocalPlayer or game.Players.PlayerAdded:Wait()

local main = script.Parent.Parent.Parent.InventoryFrame
local replicated = game:GetService("ReplicatedStorage")
local remotes = replicated.RemoteEvents
local inventoryremotes = remotes.Inventory

local cooldown = false

for index, child in pairs(script.Parent:GetChildren()) do
	if child:IsA("TextButton") then
		child.MouseButton1Click:Connect(function()
		  if child.Name == "Equip" then
			if child.Text == "Equip" then
				for index, items in pairs(main:GetChildren()) do
					if items:IsA("ImageButton") and cooldown == false then
						if script.Parent.ItemDisplayed.Value == items and items.Equipped.Value == false then
							items.Equipped.Value = true
							inventoryremotes.EquipItem:FireServer(items.name, items.Tool.Value, "Equipped")
							print("Activated Remote 1")
							child.Text = "Unequip"
							cooldown = true
							wait(1)
							cooldown = false
						end
					end
			     end
			elseif child.Text == "Unequip" then
				for index, items in pairs(main:GetChildren()) do
						if items:IsA("ImageButton") and cooldown == false then
							if script.Parent.ItemDisplayed.Value == items and items.Equipped.Value == true then
								items.Equipped.Value = false
								inventoryremotes.EquipItem:FireServer(items.name, items.Tool.Value, "Unequipped")
								print("Activated Remote 2")
								child.Text = "Equip"
								cooldown = true
								wait(1)
								cooldown = false
							end
							end
						end
			 		end
			   end
	    end)
	end
end

As you can see, I went through alot of tables, I have an object value in my ImageButton for the Item and I wanted that objectvalue’s value to be the Tool that was cloned in the player backpack.
Here’s my remote script:

local plr = game:GetService("Players").LocalPlayer or game.Players.PlayerAdded:Wait()

local replicated = game:GetService("ReplicatedStorage")
local remotes = replicated.RemoteEvents
local inventoryremotes = remotes.Inventory
local backpack = plr

inventoryremotes.EquipItem.OnServerEvent:Connect(function(plr, item, object, condition)
	if condition == "Equipped" then
		local selecteditem = replicated.Fruits.Fruit[item]:Clone()
		selecteditem.Parent = plr.Backpack
		object = selecteditem
		print("equipped that sheesh")
	elseif condition == "Unequipped" then
		for index, equippedItems in pairs(plr.Backpack:GetChildren()) do
			if equippedItems.Name == item then
				if object == equippedItems then
					local deleteitem = plr.Backpack[item]
					deleteitem:Destroy()
					object = nil
				end
			end
			print("Destroyed that sheesh")
		end
	end
end)

Maybe, instead of sending the name, you could try sending the path to the instance.

From a local script you would use FireServer() in order to fire the server, the RemoteEvent would then be used inside a server script with a corresponding OnServerEvent event which is fired whenever a call to “FireServer()” with the respective RemoteEvent is made.

that’s exactly what im doing, I literally posted my scripts…

Alright, I see it’s something to do with an ObjectValue. Do you have any errors in console when running in studio?

how can I do that? in the local script there’s a for table to find the correct slot that has the object value and I want to connect to the tool.

for index, items in pairs(main:GetChildren()) do -- table to find the correct slot button
					if items:IsA("ImageButton") and cooldown == false then 
						if script.Parent.ItemDisplayed.Value == items and items.Equipped.Value == false then
							items.Equipped.Value = true
							inventoryremotes.EquipItem:FireServer(items.name, items.Tool.Value, "Equipped") -- fires the remote
							print("Activated Remote 1")
							child.Text = "Unequip"
							cooldown = true
							wait(1)
							cooldown = false
						end
					end
			     end

The objectvalue is named “tool” and I want the value to be the item tool that gets cloned in the player’s backpack, I’m just gonna put the file in here so you can see for yourself.inventorygui.rbxl (335.0 KB)

Nope, I don’t see any. It has no errors in console at all, I posted the file in my previous reply to @Dyzody you may access the stuff there to see for yourself. (If you wanna put an item to your inventory just go to the replicated storage values and then copy one or any amount of them and paste them into your plr.Data.Inventory folder)