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

How to make sure no BrickColor is repeated when changing a group of brick's BrickColor randomly?

Asked by 9 years ago
01door = script.Parent 
02local list = game.ServerStorage.Colors:GetChildren()
03local list2 = game.Workspace.Colors4.pads:GetChildren()
04local pm = game.ServerStorage.pm.Value
05function onChatted(msg, recipient, speaker)
06local num = 0
07 
08 
09local source = string.lower(speaker.Name)
10msg = string.lower(msg)
11 
12if (msg == ":randomize") then
13 
14repeat
15 
View all 29 lines...

The script I have works fine but it has 1 problem. I do not want the color to be repeated onto any of the bricks. I tried using variables in a earlier version of this script but that did not work.

Thanks if you decide to help out, thanks if you just read this. - UltChowsk

2 answers

Log in to vote
0
Answered by 9 years ago
01door = script.Parent 
02local list = game.ServerStorage.Colors:GetChildren()
03local list2 = game.Workspace.Colors4.pads:GetChildren()
04local pm = game.ServerStorage.pm.Value
05function onChatted(msg, recipient, speaker)
06    local num = 0
07    --------------------------
08    function colorCheck(tab,val) -- function, so you can do multiple times
09        for _,v in pairs (tab) do
10            if v == val.Value then
11                return false
12            else
13                return true
14            end
15        end
View all 49 lines...
0
I put it in and got a stack overflow. UltChowsk 85 — 9y
0
Any idea how to prevent that? UltChowsk 85 — 9y
0
It may be becausen you used up all of the brickcolors available. TheDeadlyPanther 2460 — 9y
0
I have 9 seperate colors. Thats what the local variable list is for, I am trying to get it to pick from those 9 to change 9 different bricks without any repeats. UltChowsk 85 — 9y
View all comments (2 more)
0
Then it should work. TheDeadlyPanther 2460 — 9y
0
I got a stack overflow every time I tried. UltChowsk 85 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I fixed it, I used another script to reset the values and it all works fine now. :D

Answer this question