Expected identifier when parsing expression, got '.'

I am unsure exactly where to find this simple syntax error, as I’m a new developer. I’ve tried adding and revoking “end”, but nothing has stuck. Any help would be very much appreciated!

Here’s the code with the invalid syntax.

proximityEvent.OnServerEvent:Connect(function(player)
	if player.Backpack:FindFirstChild("Food Tray") then
		itemCooked = true
	else
		itemCooked = false
	end
		if not itemCooked then
			if player.Backpack:FindFirstChild("Tray") then
				player.Backpack:FindFirstChild("Tray"):Destroy()
			end
			local foodTrayClone = foodTray:Clone()
			local foodTrayClone.Parent = player.Backpack
			end
		end	
	end)
proximityEvent.OnServerEvent:Connect(function(player)
	if player.Backpack:FindFirstChild("Food Tray") then
		itemCooked = true
	else
		itemCooked = false
	end
	if not itemCooked then
		if player.Backpack:FindFirstChild("Tray") then
			player.Backpack:FindFirstChild("Tray"):Destroy()
		end
		local foodTrayClone = foodTray:Clone()
		foodTrayClone.Parent = player.Backpack
	end	
end)

Ah, thank you for this solution!

Is this a syntax error or is your code not working as intended? If it was a syntax error I want to say you could open output in the view tab. Just saying because if you dont then it should help in later errors.

Yeah, it was a simple syntax error that I couldn’t detect.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.