How should I make a system, that gives the player that got rightclicked the item that is currently equipped? (2 options given)

I want to make a system, that gives the player that got rightclicked the item that is currently equipped.

Which option would work?

Option1: Player rightclicks something (Local Script) → Remote Event (Server Script) → let the server decide if the guy who got rightclicked has a humanoid or not (Server Script) → give him the item (Server Script)

Option2: Player rightclicks something (Local Script) → The localscript decides if the thing that got rightclicked has a humanoid or not (Local Script) → if it does, then remote event (Server Script) → Give him the item (Server Script)

Why not have everything server sided it saves the need to fire remote events that cause traffic.

1 Like

How could I define the player’s mouse in a server script? I need to make something like

Tool.Equipped:Connect(function()
	isEquipped = true
end)

Tool.Unequipped:Connect(function()
	isEquipped = false
end)


mouse.Button2Down:Connect(function()
if isEquipped == true then
		
		
		local MouseTarget = mouse.Target
--Check if the mouseTarget has a humanoid or not```

Iterate through all the players,

for i,v in ipairs(game.Players:GetPlayers()) do

end
1 Like