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

The brick is NOT turning colors...?

Asked by 8 years ago

I'm having a ton of trouble on this but I'm ALMOST there!! The brick isn't turning colors, and after looking at the Wiki for a while, I can't find anything!

bag = script.parent.parent.parent

function onClick()
    bag.brickColor = Color3.new(25,25,255)
end

script.Parent.MouseButton1Click:connect(onClick)

Bag is a Handle, a suitcase, and it is supposed to change colors when you click a color on this GUI!

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

Almost everything in this script is wrong.

Read the output and it will tell you that things are amiss.

Names are case sensitive.

You must use .Parent instead of .parent. You must use .BrickColor instead of .brickColor.

Colors

A Color3 is not a BrickColor. BrickColors are constructed by their names. E.g.,

bag.BrickColor = BrickColor.new("Bright blue")

Color3.new takes parameters between 0 and 1, not 0 and 255. You must scale them down. Thus Color3.new(0.1, 0.1, 1) is approximately the color you're asking for. You can convert a Color3 value into a BrickColor using the BrickColor constructor:

bag.BrickColor = BrickColor.new( Color3.new(0.1, 0.1, 1) )
0
The output is like this: 14:56:36.207 - BrickColor is not a valid member of ScreenGui 14:56:36.207 - Script 'Players.Player.PlayerGui.Magazine.Frame.Blue.Color script', Line 4 14:56:36.208 - Stack End VirtualFlying 55 — 8y
0
The error tells you what's wrong. `bag` right now is a ScreenGui, not a part. So it doesn't have a "BrickColor" property. BlueTaslem 18071 — 8y
Ad

Answer this question