local part = script.Parent local clickDetector = part:FindFirstChild("ClickDetector") -- Function to generate a random BrickColor local function getRandomColor() local r = math.random() local g = math.random() local b = math.random() return Color3.new(r, g, b) end -- When the part is clicked clickDetector.MouseClick:Connect(function(player) part.Color = getRandomColor() print(player.Name .. " clicked the part! Color changed.") end)