Expected identifier when parsing expression, got '='

Im trying to make it so you can drop items in your inventory for my survival game
it seems to just be a typing error but I don’t really know where I got wrong
it says "Expected identifier when parsing expression, got ‘=’ "

DropItem:FireServer() = function(player, itemName)
	local Inventory = player.Inventory
	local item = Inventory:FindFirstChild(itemName)
	if item then
		if item.Value>0 then
			item.Value = item.Value - 1
			local itemClone= Items:FindFirstChild(itemName):Clone()
			itemClone.CFrame = player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6 -- clone the part infront of player
			itemClone.Parent = game.Workspace
			return true
		else
			return false
		end
	end
end
1 Like

You can fix the error by putting a space between “itemClone” and the “=”.
Also, why do you need a custom drop system? Roblox already gives you a setting to make players be able to drop items.

1 Like

You can put spaces anywhere you want, you dont even need spaces for the = sign, but your problem is with line 1.

1 Like

i did add the space on but it has something to do with the top line of the code i put

1 Like

Oh, yeah didn’t notice that.
Are you trying to pickup an event that a client fired?

1 Like

Replace that with this:

DropItem.OnServerEvent:connect(function(player,ItemName)
    --script
end)
3 Likes

yeah it is supposed to fire a remote event

1 Like

That would fix it but you should’ve gave an explanation on what he did wrong.

1 Like

Are you trying to fire an event from the client or pickup an event from the server?
If you’re trying to fire an event, the correct usage is this:

RemoteEvent:FireServer(data)

A better explanation is given here:

3 Likes

Also if you solved it, consider marking this post solved with my message, so people that come to this post will know that it’s solved and you no longer require help.

1 Like