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

Just practicing my Lua, but I need help. Why does my repeat...until work?

Asked by 7 years ago
local A = game.workspace.Part
local B = game.workspace.Baseplate
local BlocksAllowed = 10
local function Initialize_A()
    A.BrickColor = BrickColor.Random()

    local ACopy = A:Clone()
        ACopy.Parent = game.workspace
end
wait(2)
while true do
    Initialize_A()
    wait(1)
    print("check")
    repeat Initialize_A()

    until Initialize_A() > 5
end
0
An easy fix for experienced scripters KyleTheConqueror 5 — 7y
0
Idk what you're trying to do so here's this x=0 repeat x=x+1 game.Workspace.BrickColor=BrickColor.Random() until x>=5 Earthkingiv 51 — 7y
0
The goal I was trying to accomplish was to clone a brick, that changes colors with the original brick, but stops after a certain amount of bricks. It's not a script for any serious game play, just practice. KyleTheConqueror 5 — 7y

1 answer

Log in to vote
0
Answered by
wookey12 174
7 years ago

i don't know why you are trying to make a function a variable. you can easily solve this by calling the function.

local A = game.workspace.Part
local B = game.workspace.Baseplate
local BlocksAllowed = 10
local AmountOfClones = 0
function Initialize_A()
    A.BrickColor = BrickColor.Random()

    local ACopy = A:Clone()
        ACopy.Parent = game.workspace
end
wait(2)
while true do
    Initialize_A()
    wait(1)
    print("check")
    repeat 
    Initialize_A()
    AmountOfClones = AmountOfClones + 1
    until AmountOfClones == 5
if AmountOfClones == 5 then
break
end
end

I havn't tried it yet, but it looks to be clear!

Ad

Answer this question