Issue with my remote event

Hi, i making combat system for my game but there is issue that i place remote event in replicated storage and then player in game get remote event in same time and do same thing at same times like this

I don’t know where i should i place my remote event please help me

i also create parameter and it dont work
Here in my local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local EquipSword = ReplicatedStorage:WaitForChild("EquipSword")
local UserInputService = game:GetService("UserInputService")
local Attack = ReplicatedStorage:WaitForChild("Attack")
local function onInputBegan(input, gameProcessed)
	if input.KeyCode == Enum.KeyCode.E then
		EquipSword:FireServer(player.Name)
	elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
		Attack:FireServer(player.Name)
	end
end

UserInputService.InputBegan:Connect(onInputBegan)

And this is some my script that get remote event

game.ReplicatedStorage.EquipSword.OnServerEvent:Connect(function(hhh, parameter)
	if not parameter ~= player.Name then
		EquipSword()
	end
end)
equipsword = false
EquipSword()
respawned = true
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function(hhh, parameter)
	if not parameter ~= player.Name then
		swing()
	end
end)

In your server script, where you are listening to the Event, the “hhh” is suppose to be the Player object and the “parameter” is the Player name that you sent (Though I don’t understand your use case but sending the player name is unnecessary), however, what is the “player” that you are comparing?

(if not parameter ~= player.Name then)

what you can do is

game.ReplicatedStorage.EquipSword.OnServerEvent:Connect(function(hhh, parameter)
	if hhh == player then
		EquipSword()
	end
end)
equipsword = false
EquipSword()
respawned = true
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function(hhh, parameter)
	if hhh == player then
		swing()
	end
end)

Hi, Thank everyone for anwser my question i solved it
i placed RemtoeEvent Wrong place :sweat_smile: