So, i tried to make a part change it’s color on click, but it didn’t work
Script’s contenents:
if script.Parent.ClickDetector.MouseClick
local BrickColor = (141)
end
explorer:
So, i tried to make a part change it’s color on click, but it didn’t work
Script’s contenents:
if script.Parent.ClickDetector.MouseClick
local BrickColor = (141)
end
explorer:
You have to connect a function to the ClickDetector’s MouseClick
event, like so:
script.Parent.ClickDetector.MouseClick:Connect(function(player)
script.Parent.BrickColor = BrickColor.new("Really Red")
-- or
script.Parent.Color = Color3.new(255, 0, 0) -- use RGB
end)
Change it to script.Parent.BrickColor = BrickColor.new(141)
local part = workspace.Part
local clickDetector = part.ClickDetector
function onClick()
part.Color = Color3.new(144,0,0) --You have to use RGB in order to work so change the 144 to each 0 until you get to the wanted color
end
clickDetector.MouseClick:Connect(onClick)
This should work
Thanks for the help everyone, i forgot to mention that i’m still very new to scripting.
Just keep practicing and you’ll be good!
You can check the many tutorials on youtube, or the Developer Hub for great knowledge.