Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

invalid argument #1 to 'new' (Color3 expected, got BrickColor) will you help?

Idk what to do for the brickcolor thing. I'm trying to assign the brickcolor from a brickcolor value.

local XYZValue = script.Parent.Handle.XYZValue

local plr = game.Players.LocalPlayer

function Click()
	local Part = Instance.new("Part", game.Workspace.CloneFolder)
	Part.Size = XYZValue.Value
	Part.Position = plr.Character:WaitForChild("Humanoid").TargetPoint
	Part.CanCollide = script.Parent.Handle.CanCollideValue.Value
	Part.Anchored = script.Parent.Handle.AnchoredValue.Value
	Part.Color = script.Parent.Handle.ColorValue.Value
end

script.Parent.Activated:Connect(Click)

FIXED!!!

2 answers

Instead of Color, you need to do BrickColor.

local XYZValue = script.Parent.Handle.XYZValue

local plr = game.Players.LocalPlayer

function Click()
    local Part = Instance.new("Part", game.Workspace.CloneFolder)
    Part.Size = XYZValue.Value
    Part.Position = plr.Character:WaitForChild("Humanoid").TargetPoint
    Part.CanCollide = script.Parent.Handle.CanCollideValue.Value
    Part.Anchored = script.Parent.Handle.AnchoredValue.Value
    Part.BrickColor = BrickColor.new(script.Parent.Handle.ColorValue.Value)
end

script.Parent.Activated:Connect(Click)

1 comment

0

It still says smth about 'new'

Try this:

local XYZValue = script.Parent.Handle.XYZValue

local plr = game.Players.LocalPlayer

function Click()
    local Part = Instance.new("Part", game.Workspace.CloneFolder)
    Part.Size = XYZValue.Value
    Part.Position = plr.Character:WaitForChild("Humanoid").TargetPoint
    Part.CanCollide = script.Parent.Handle.CanCollideValue.Value
    Part.Anchored = script.Parent.Handle.AnchoredValue.Value
    Part.Color = Color3.new(script.Parent.Handle.ColorValue.Value)
end

script.Parent.Activated:Connect(Click)

This discussion is preserved as it was. New answers, comments, and votes are closed.