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

How can I change part's BrickColor, when Hover with Mouse?

Basically, I don't really know how to do it, I can't even give it a go.

I know how to get mouse and the target

local theMouse = game.Players.LocalPlayer:GetMouse()
print(theMouse.Target)

This will just print on what the mouse is Targeting, but how can I change the brickcolor of what the mouse is hovering to?

1 answer

Check if the Mouse’s target is a Part and then change Part.BrickColor to your desired BrickColor.


local theMouse = game.Players.LocalPlayer:GetMouse()
local Target = theMouse.Target

if Target:IsA(‘BasePart’) then
Target.BrickColor = BrickColor.new(‘Toothpaste’) -- Change Toothpaste to your BrickColor
end

2 comments

0

attempt to index nil with 'IsA'

0

Change the ‘ to a normal quotation mark because my keyboard is weird, and it should work.

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