Player presses input and everyone in the server is effected

I am trying to make a simple pickup and drop tool system but just cant rap my head around it, I have made a local script into StarterPlayerScripts which looks like this:

local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local char = player.Character or player.CharacterAdded:Wait()


UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode["F"] then
		game.ReplicatedStorage.DropTool:FireServer()
	end
end)

Server script:

game.ReplicatedStorage.DropTool.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	local tool = char:FindFirstChildWhichIsA("Tool")
	tool.Parent = workspace
end)

However when someone on the server pressed “F” it effects everyone on the server, for example when another player is already holding a tool and a player tries to pickup a tool using “F” the player who is already holding a tool their tool drops.

Here is a video example:

1 Like