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

How to make a tool activate and then changes its color to red?

Asked by 7 years ago
Edited by shayner32 7 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

Hello,

I would like the tool change color when the player activates it. I'm trying to make it like 3 mounths and my script is not working:

local brick = game.StarterPack.brick -- The tool

brick.Activated:connect(function()
    brick.BrickColor = ("New Yeller")
end)

Any help would be greatly appreciated.

Thank you, SquidoTV

0
You mean equipped? PyccknnXakep 1225 — 7y
0
No. I mean activated MajinBluee 80 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

Hello Squido! You should format your questions better. Put code within the code block. http://prntscr.com/g1428q

You want the tool to change colors when activated? Firstly, let me explain what Activated does

When you do a function that runs when a tool is Activated then that is when the player clicks with the tool equipped. So if you want it when activated, this will work: I'd so like to let you know to put this in a script inside the tool

tool = script.Parent
brick = tool.Brick --Change this to the parts location that you want to change

tool.Activated:connect(function()
brick.BrickColor = ("New Yeller") 
end)

Okay, so this changes the parts color to New Yeller when the player clicks. I do not fully understand your question so I'll also do this for you:

tool = script.Parent
brick = tool.Brick --Change this to the parts location that you want to change

function Equip()
brick.BrickColor = ("New Yeller") 
end)
tool.Equipped:connect(Equip)

So this runs when the tool is equipped. If you need anymore help, don't hesitate to ask! Also please remember in the future to use the code block when posting your code. http://prntscr.com/g1428q

0
Put links in the link things so we can click on them hiimgoodpack 2009 — 7y
0
EddieLJones the script is not working i dont know why. And the script that i wanted its the activated script. MajinBluee 80 — 7y
0
Because he had alot of errors. 1.) He didn't use WaitForChild 2.) he didn't do BrickColor = BrickColor.new DogHouseForMe 0 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

This is one way

tool = script.Parent
handle = tool:WaitForChild("Handle")
tool.Activated:Connect(function()
handle.BrickColor = BrickColor.new("Really red")
end)
tool.Unequipped:Connect(function()
handle.BrickColor = BrickColor.new("White")
end)

Answer this question