local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "CreatePartEvent"
local function onCreatePartFired(player, color, position)
print(player.Name, "wants to create a part")
local newPart = Instance.new("Part")
newPart.BrickColor = color
newPart.Position = position
newPart.Parent = game.Workspace
end
createPartEvent.OnServerEvent:Connect(onCreatePartFired)
When use this even it needs to be "local function OnCreatePartFired" or else it won't work. I just know one works and the other doesn't. Can someone explain why it needs to be a local function and can't just be "function OnCreatePartFired"?

4 comments
https://scriptinghelpers.org/questions/16395/what-are-the-differences-between-local-function-and-function
That explains what declaring something to be local is. Which I understand, but what I don't understand is why onCreatPartFired needs to be local because if it wasn't it doesn't work.
that also declares what it does, if you connect those two they will answer your question of why its needed
Simple answer: It doesn't require a local function. This is just an issue with your code in general.