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

Instead of using BrickColor?

I've been working on this project and I'm sooo close. My function is that when you hit the Blue button on the GUI, the Suitcase (named handle) turns to that color blue. I'm trying to use Brickcolor, but someone told me it WAS NOT Brickcolor, and to use something else, but what should I use?

local player = game.Players.LocalPlayer
local bag = player.Backpack:WaitForChild("Suitcase"):WaitForChild("Handle")
bag = script.Parent.Parent.Parent.Parent

function onClick()
    bag.BrickColor = BrickColor.new("Bright blue")
end

script.Parent.MouseButton1Click:connect(onClick)

1 comment

0

You've posted so many questions on near-miss identical topics, please reduce the amount of questions you're posting.

2 answers

✓ Accepted answer

MouseButton1Down is for GUIs.

if script.Parent means the tool then the code should go something like this.

local player = game.Players.LocalPlayer
local bag = player.Backpack:WaitForChild("Suitcase"):WaitForChild("Handle")
bag = script.Parent.Parent.Parent.Parent

function onClick()
    bag.BrickColor = BrickColor.new("Bright blue")
end

script.Parent.Activated:connect(onClick)

Parts use BrickColor and other objects, such as GUIs, use Color3.

2 comments

0

So, in my script would I replace on the function BrickColor's and replace them with Color3s...?

0

Parts cannot directly accept a Color3. You must use the BrickColor.new constructor when working with parts. If you want to use Color3s with parts, you must use a syntax similar to this: BrickColor.new(Color3.new(1, 1, 1)). The code you are using looks correct and more efficient.

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