Code issues - brickcolor error in script

Hello! could someone help me with that, what’s wrong in my code?

Exactly this part:
script.Parent.BackgroundColor3 = BrickColor.new("Bright green")

full script

local Player = game:GetService("Players").LocalPlayer

Character = Player.Character or Player.CharacterAdded:Wait()

Humanoid = Character:WaitForChild("Humanoid")

Animator = Humanoid:WaitForChild("Animator")

local dance = Instance.new("Animation")

dance.AnimationId = "rbxassetid://5937558680"

local danc = Animator:LoadAnimation(dance)

local Play = false

script.Parent.MouseButton1Click:Connect(function()

if Play == false then

danc:Play()

script.Parent.BackgroundColor3 = BrickColor.new("Bright green")

Play = true

else

danc:Stop()

Play = false

end

end)
1 Like

use Color3 instead of BrickColor,
script.Parent.BackgroundColor3 = Color3.new(0,1,0)

3 Likes

Color3.new takes arguments ranging from 0-1. You need to use Color3.fromRGB which takes arguments from 0-255.

2 Likes

and what about white color? :scream:

1 Like

If you want it to be white change it to 255,255,255

2 Likes

I rarely use Color3, sorry
now fixed

1 Like

Thanks a lot guys, I just implemented it in my code and it works great! :smiley:

1 Like

You can also use BrickColor.new().Color which is the Color3 value.

1 Like