Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago
Edited 2 years ago

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

Log in to vote
0
Answered by 2 years ago

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)

0
It still says smth about 'new' NotDrReplayz 0 — 2y
Ad
Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
2 years ago

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)

Answer this question