#how do i make a specific randomizer?

33 messages · Page 1 of 1 (latest)

clear flame
#

Hello! im trying to make a function where i have 10 parts and after 10 seconds they change colors. BUT out of those 10 parts, i want 1 of them to become red, 2 of them to become green and 7 of them to become gray. How would i be able to do this?

slow basin
woeful junco
#

I'm making something @clear flame , once I finish I'll lyk how to make it and send code

woeful junco
#

@clear flame Let me ask a few questions, firstly what is your knowledge with Lua and Luau?

clear flame
#

ive never tried luau for something else than roblox studio

woeful junco
#

well luau is only available for Roblox

clear flame
woeful junco
#

By my understanding you want a randomizer that checks for 10 parts, and wants the parts to be subdivided in "categories" color coded?

woeful junco
#

It's extremely late rn @clear flame so ima just give u half of what I've done and explain tomorrow

#

uh

#

It wont let me send code

dawn tundra
#

Use i,v pairs and math.random

#

Oh actually

#

Use for loop to check how many of each colour there are

#

Example:

if greenCount >= 2 then greenProbability == 0 end
if grayCount >= 7 then grayProbability == 0 end```
#

Then u use i,v pairs and math.random to randomize the colours based on the sumed probabilities

#

I suppose u understand the rest if u have 1yr+ lua experience

naive lanceBOT
#

studio** You are now Level 7! **studio

dawn tundra
torn swift
#

You want certain colours to be more rare, @clear flame?

#

Or are you just colouring a certain number of parts per random colour?

clear flame
torn swift
clear flame
naive lanceBOT
#

studio** You are now Level 2! **studio

torn swift
clear flame
torn swift
#

TL;DR: It's an algorithm that enables you to attach weights (chances) to values so you can directly manipulate the likelihood of getting one of those values

woeful junco