RemoteEvent not spawning part

  1. What do you want to achieve? Keep it simple and clear!

I was learning how to use RemoteEvents, and set up a test that should spawn a red part.

  1. What is the issue? Include screenshots / videos if possible!

When I start the game, I get this error:
image
Here is my code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")

local function onCreatePart(player, partColour, partPos)
    print(player.Name .. " fired the remote event")
    local newPart = Instance.new("Part", workspace)
   	    newPart.BrickColor = BrickColor.new(partColour)
    newPart.Position = partPos
end

RemoteEvent.OnServerEvent:Connect(onCreatePart())
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I noted that I had an error with the BrickColor, fixed that, and it still did not spawn the part.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

That is about it, if you want the LocalScript that fires the event, I will happily post it for you.

Remove the brackets from the end of the function.

RemoteEvent.OnServerEvent:Connect(onCreatePart)

Thanks, it worked, but now a new error shows up saying this:
image
Any ideas how to fix this?

That means in the client script you are passing another instance of BrickColor, so it looks like BrickColor.new(BrickColor.new(name)) when no overload of the BrickColor constructor takes another brick color

Thanks, I fixed it and now it works!