this is the script,
function onClick(clicked)
game.Workspace.DanceFloor.Part1.BrickColor = BrickColor.new("random")to happen
script.Parent.MouseButton1Down:connect(clicked)
this is the script,
function onClick(clicked)
game.Workspace.DanceFloor.Part1.BrickColor = BrickColor.new("random")to happen
script.Parent.MouseButton1Down:connect(clicked)
What is this monstrosity of code? Okay, so first you should've specified if this was a local script that is parented to the player or a script parented to the brick. If it's the former then use this.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
function onClick()
game.Workspace.DanceFloor.Part1.BrickColor = BrickColor.random()
end
mouse.Button1Down:connect(onClick)
Otherwise if the script is parented to the brick then you're gonna want to use a clickdetector and use this code instead.
local click = script.Parent.ClickDetector
function onClick()
script.Parent.BrickColor = BrickColor.random()
end
click.MouseClick:connect(onClick)
This should work and you're welcome.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
please help
Technically, you should implement BrickColor.random(), using BrickColor.new() can choose specific colors.