BrickColor is becoming an instance in an event

In my RemoteEvent it keeps calling a BrickColor an Instance.
Workspace.Script:8: invalid argument #3 (BrickColor expected, got Instance)

I don’t know why. The first value is a player.

Can you show us your code so we help you with your problem?

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local tool = script.Parent
local equipped = false
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("PlaceFlooring")
local Player = game.Players.LocalPlayer
local color = script:GetAttribute("color")
print(color)

tool.Equipped:Connect(function()
	equipped = true
	repeat
		ghostBlock = Instance.new("Part")
		ghostBlock.Size = Vector3.new(8, 0.5, 8)
		ghostBlock.BrickColor = BrickColor.new("Lime green")
		ghostBlock.Transparency = 0.5
		ghostBlock.Material = Enum.Material.SmoothPlastic
		ghostBlock.Anchored = true
		ghostBlock.CanCollide = false
		ghostBlock.Parent = workspace
		ghostBlock.Position = mouse.Hit.p
		wait()
		ghostBlock:Destroy()
	until equipped == false
	ghostBlock:Remove()
end)

tool.Unequipped:Connect(function()
	equipped = false
end)


tool.Activated:Connect(function()
	remoteEvent:FireServer(Player, color, ghostBlock.Position)
end)

hmm, can you also show us the part that serverscript receives the event?

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("PlaceFlooring")


local function onCreatePart(Player, partColor, partPos)
	local newPart = Instance.new("Part")
	newPart.BrickColor = partColor
	newPart.Position = partPos
	newPart.Size = Vector3.new(8, 0.5, 8)
	newPart.Material = Enum.Material.WoodPlanks
	newPart.Parent = workspace
end


remoteEvent.OnServerEvent:Connect(onCreatePart)

See my solution to this thread, you’re having the same issue as them. The first argument of OnServerEvent is always the player, it does not need to be passed.

1 Like

Oh I see your problem, you don’t need to fire the remoteEvent with player argument since function does that for you. Just change remoteEvent:FireServer(Player, color, ghostBlock.Position) to remoteEvent:FireServer(color, ghostBlock.Position)