local clickPart = script.Parent -- Create a ClickDetector and set its parent local clickDetector = Instance.new("ClickDetector") clickDetector.Parent = clickPart local function onPartClick(player) -- Output a message and randomly color the clicked part print(player.Name .. " clicked me!") clickPart.BrickColor = BrickColor.random() end clickDetector.MouseClick:Connect(onPartClick)