Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Repeating scripts on Clicked?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

Can someone show me how I can make this into a repeating script? It still has to be Clicked()

function Clicked()
    brick = game.Workspace
--Color part
brick.SurfacePart.Lights.LightPart1.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart2.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart3.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart4.BrickColor = BrickColor.random()
wait(0.5)
brick.SurfacePart.Lights.LightPart1.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart2.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart3.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart4.PointLight.Color = Color3.random()
end

script.Parent.MouseButton1Down:connect(Clicked)
0
So, when you click script.Parent, you want it to change the colours infinitely? Articulating 1335 — 10y
0
Yes NotSoNorm 777 — 10y

3 answers

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago

This will make it so it never stops.

function Clicked()
    brick = game.Workspace
while true do
--Color part
brick.SurfacePart.Lights.LightPart1.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart2.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart3.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart4.BrickColor = BrickColor.random()
wait(0.5)
brick.SurfacePart.Lights.LightPart1.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart2.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart3.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart4.PointLight.Color = Color3.random()
end
end

script.Parent.MouseButton1Down:connect(Clicked)

0
Sorry, I kind of needed to keep changing colors when you click on it. Is that possible? NotSoNorm 777 — 10y
Ad
Log in to vote
1
Answered by 10 years ago
function Clicked()
    local brick = game.Workspace
    while true do
        brick.SurfacePart.Lights.LightPart1.BrickColor = BrickColor.Random()
        brick.SurfacePart.Lights.LightPart2.BrickColor = BrickColor.Random()
        brick.SurfacePart.Lights.LightPart3.BrickColor = BrickColor.Random()
        brick.SurfacePart.Lights.LightPart4.BrickColor = BrickColor.Random()
        wait(0.5)
        brick.SurfacePart.Lights.LightPart1.PointLight.Color = BrickColor.Random().Color
        brick.SurfacePart.Lights.LightPart2.PointLight.Color = BrickColor.Random().Color
        brick.SurfacePart.Lights.LightPart3.PointLight.Color = BrickColor.Random().Color
        brick.SurfacePart.Lights.LightPart4.PointLight.Color = BrickColor.Random().Color
    end
end

script.Parent.MouseButton1Down:connect(Clicked)
Log in to vote
0
Answered by
dreamy67 135
10 years ago
function Clicked()
    brick = game.Workspace
while true do
--Color part
brick.SurfacePart.Lights.LightPart1.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart2.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart3.BrickColor = BrickColor.random()
brick.SurfacePart.Lights.LightPart4.BrickColor = BrickColor.random()
wait(0.5)
brick.SurfacePart.Lights.LightPart1.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart2.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart3.PointLight.Color = Color3.random()
brick.SurfacePart.Lights.LightPart4.PointLight.Color = Color3.random()
end
end

script.Parent.MouseButton1Down:connect(Clicked)

I think this works, I didn't test it. I'm on my ipad right now

Answer this question