Is the "player" parameter the issue with this RemoteEvent?

Hi, when the server receives the RemoteEvent, it’s not working any of the logic statements, is it my player parameter? Here is my code:

Local Script (Event fired):

script.Parent.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
	local EquippedItem = player:FindFirstChild("equippedItem")
	if script.Parent.Name == "Item" then
		game.ReplicatedStorage.Events.EquipItem:FireServer(player, "Item", EquippedItem.Value)
	elseif script.Parent.Name == "Gun" then
		game.ReplicatedStorage.Events.EquipItem:FireServer(player, "Gun")
	elseif script.Parent.Name == "Knife" then
		game.ReplicatedStorage.Events.EquipItem:FireServer(player, "Knife")
	end 	
end)

Server Script (Event Received):

game.ReplicatedStorage.Events.EquipItem.OnServerEvent:Connect(function(player, ItemType, ItemName)
	local active = false
	local InnocentItems = game.ReplicatedStorage.InnocentItems
	for i, v in pairs(player.Character:GetChildren()) do
		if v.Name == "Knife" or v.Name == "Gun" or v.Name == "Item" then
			active = true
		end
	end
	
	if ItemType == "Item" then
		if not active then
			local Item = InnocentItems:FindFirstChild(ItemName):Clone()
			Item.Name = "Item"
			Item.Parent = player.Character
		else
			player.Character:FindFirstChild("Item"):Destroy()
		end
	elseif ItemType == "Gun" then
		if not active then
			if player:FindFirstChild("Sheriff") then
				local gun = game.ServerStorage.Items.Revolver:Clone()
				gun.Name = "Gun"
				gun.Parent = player.Character
			end
		else
			player.Character:FindFirstChild("Gun"):Destroy()
		end
	elseif ItemType == "Knife" then
		if not active then
			if player:FindFirstChild("Murderer") then
				local knife = game.ServerStorage.Items.ClassicSword:Clone()
				knife.Name = "Knife"
				knife.Parent = player.Character
			end
		else
			player.Character:FindFirstChild("Knife"):Destroy()
		end
	end
	
end)

Fixed, can’t have “player” in the firing of a remote event.

To further explain this: All remotes always pass the player to the server if they were fired by a client, thus it is not necessary to add player into the tuple parrameter.

1 Like