Тёмный

Random - Roblox Beginners Scripting Tutorial #15 (2024) 

BrawlDev
Подписаться 22 тыс.
Просмотров 15 тыс.
50% 1

DISCORD 📜
Join my Discord Community if you want scripting help, participate in events/challenges, and make friends!
/ discord
MEMBERSHIPS 🎁
Get Access To My Scripts + More Perks By Becoming a Channel Member! 👇
/ @brawldevrblx
BEGINNER ROBLOX SCRIPTING SERIES 🟢
• Roblox Beginners Scrip...
ROBLOX GUI TUTORIAL SERIES 🎨
• Roblox GUI Tutorial Gu...
ADVANCED ROBLOX SCRIPTING SERIES 🔴
• Roblox Advanced Script...
TWITTER / X 🐦
/ brawlbattlerblx
In this NEW 2024 Guide to Roblox Scripting for Beginner Developers, I will go through everything you need to know to continue scripting on Roblox!
My new mission is to have fun teaching everything I know from developing games on Roblox since 2016. We will dive into scripting concepts as basic as printing to as complicated as raycasting. For every episode of this series, I encourage you to do everything I do to gain experience and let it stick with you so that you can create the games you're passionate about on your own. Enjoy this series and remember: being a competent scripter takes time and effort so don't get discouraged if things get too tricky. Remember where your inspirations came from; if you can be a Roblox scripter, then anyone can!
Tags:
#roblox #robloxstudio #robloxscript #robloxscripting #robloxadvancedscripting #robloxdev #robloxdevelopment #robloxdeveloper #robloxprogramming #scripting #programming #gamedev #gamedevelopment #gamedeveloper #robloxtutorial #robloxscriptingtutorial #howtomakeagameonroblox #robloxhowto #robloxcoding #coding #codingtutorial #codingtutorials #foryou
DOWNLOAD ROBLOX STUDIO HERE:
create.roblox.com
(On the left side under "Quick Links", click on "Studio" and download)

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 213   
@hechiv6085
@hechiv6085 3 месяца назад
Woah woah, slow down with the upload speed fam. I'm still practicing the previous guide🗿(I appreciate the tutorials🙏. Also, you're really good at simplifying and explaining the concepts.)
@SkullsDev
@SkullsDev 3 месяца назад
RNG games: WRITE THAT DOWN! WRITE THAT DOWN!
@TropialGamingYT
@TropialGamingYT 2 месяца назад
real
@atotallylazyperson
@atotallylazyperson Месяц назад
devs fr boutta local nochance = math.random(1, 1000000) if nochance == 1 then - - get really good aura script here end
@BlueTheCrew
@BlueTheCrew Месяц назад
@@atotallylazyperson really bad aura*
@atotallylazyperson
@atotallylazyperson Месяц назад
@@BlueTheCrew oh yeah mb
@SimplyTutuco
@SimplyTutuco 19 дней назад
@@atotallylazyperson more like this: local defaultCommonChance = math.random(1,2) if defaultCommonChance == 69 then insert default aura creation script here end
@Mr.Pegumin
@Mr.Pegumin 3 месяца назад
some of the best underatted script teaching channel man. keep up the good work!
@VoidBloomYT
@VoidBloomYT Месяц назад
heres a code that i made to signify my gambling addiction. while true do local random = math.random(1, 6) print(random) if random == 6 then print("jackpot!") end task.wait(2) end
@Architect-u2g
@Architect-u2g Месяц назад
That kinda looks like python code ngl
@Superiorrod
@Superiorrod Месяц назад
hakari
@aidandoesanimations
@aidandoesanimations 2 дня назад
MAKE A SLOT MACHINE
@LavaWander
@LavaWander 3 месяца назад
I used some of my GUI knowledge and made a button that rolls a die. This is the script I put inside it. local roll = script.Parent roll.MouseButton1Click:Connect(function() local result = roll.Parent:FindFirstChild("Result") local rolled = math.random(1, 6) if rolled == 1 then result.TextColor3 = Color3.fromRGB(255, 0, 0) elseif rolled == 6 then result.TextColor3 = Color3.fromRGB(0, 255, 0) else result.TextColor3 = Color3.fromRGB(0, 0, 255) end result.Text = "ROLLED: " .. rolled end)
@Jundazz
@Jundazz 2 месяца назад
local pet = math.random(1, 5) if pet == 1 then print("You got a cat") elseif pet == 2 then print("you got dog") else print("you got unlucky and your pet didnt hatch") end simple pet opening
@goofymctooty3650
@goofymctooty3650 Месяц назад
Ive gone from nothing to learing how to give my friends a gambling addiction thanks man
@aidandoesanimations
@aidandoesanimations 2 дня назад
💀lol
@osakadev
@osakadev 3 месяца назад
Summary (I was sleeping) math.random() is a function which generates pseudo-random numbers within the range of the first parameter and the second More data: - If you do not pass parameters, math.random() will generate numbers from 0 to 1 - If the parameter a is greater than the parameter b, then an error will be thrown (and also if b is less than a) Examples of math.random() - Get a random element from a table: local numbers = {1, 2, 3, 4, 5, 6} print(numbers[math.random(1, #numbers)] -- print a random number inside the table! By the way, results of math.random() are going to depend on math.randomseed()
@reaklaz
@reaklaz 2 месяца назад
is he feeding you? cuz i see you on every video
@osakadev
@osakadev 2 месяца назад
@@reaklaz i'm his helper
@jvdeonyourblock
@jvdeonyourblock 2 месяца назад
@@osakadev what does the "pseudo" mean
@jvdeonyourblock
@jvdeonyourblock 2 месяца назад
also your comments are really helpful, thanks
@osakadev
@osakadev 2 месяца назад
@@jvdeonyourblock pseudorandom in this case, means "numbers NOT REALLY random", cuz computers cannot generate real random numbers
@cobyjacob2054
@cobyjacob2054 2 месяца назад
-- function that prints the name of a certain world type local function randomNumber() local ranNum = math.random(1, 4) if ranNum == 1 then print("Ice world") elseif ranNum == 2 then print("Desert") elseif ranNum == 3 then print("Pirate island") elseif ranNum == 4 then print("The vulcano") end end randomNumber()
@CloudKicks.official
@CloudKicks.official 2 месяца назад
thank you very much bro. i have watched more than 100 tutorials but yours hit different i understood everything. and everything worked even doin it by my self. i cant really tell you how much i appreciate. thank you!!!
@RobloxClipShorts
@RobloxClipShorts 12 дней назад
I can't believe I'm already here, thank you so much!
@RubickO7
@RubickO7 2 месяца назад
local Rarity = math.random(1, 5) if Rarity == 1 then print("you got uncommon") elseif Rarity == 2 then print("common") elseif Rarity == 3 then print("rare") elseif Rarity == 4 then print("legendary") elseif Rarity == 5 then print("limited") end print(Rarity)
@KaYi25
@KaYi25 Месяц назад
doesnt make sense to add rarities if all the values have the same chance of being chosen.
@vmc-mal
@vmc-mal 3 месяца назад
Almost done with the playlist, have learnt quite a lot! local rng = math.random(1,64) local roof1 = game.Workspace.House.Roof1 local roof2 = game.Workspace.House.Roof2 --[[ Disabling this since I am using this script actively. print(rng)]] --This randomizes the color of the roof. while true do local rv = math.random(0,255) local gv = math.random(0,255) local bv = math.random(0,255) roof1.BrickColor = BrickColor.new(Color3.fromRGB(rv, gv, bv)) roof2.BrickColor = BrickColor.new(Color3.fromRGB(rv, gv, bv)) task.wait(.5) end
@YorSato
@YorSato 19 дней назад
3 more videos and i should be done with this and i can move to the advance one P.S this is my second day tomorow im gone watch the last 3 and i should be good to go GOOD NIGHT P.S your teaching skills are very good you should be a teach no cap
@Sky_Blue_Crew
@Sky_Blue_Crew 2 месяца назад
This is an episode I've been waiting for, its perfect for my script random color script, so here is: --set variable local partTouched = false local RandomCounter = 1 --random color loop script.Parent.Touched:Connect(function(part) if partTouched == false then local humanoid = part.Parent:FindFirstChild("Humanoid") if humanoid then partTouched = true while RandomCounter
@imthesilly-k9j
@imthesilly-k9j 16 дней назад
Yo, I have one question about this whole thing. I’m trying to make a game with my friend and you didn’t really explain one of the parts that I need to know so maybe can you explain it if you reply to this I’ll tell you what I need to explain.
@DevRRG
@DevRRG 16 дней назад
Although i am not a beginner dev i watched this Video to learn more about math.random. i made a local script inside of starterplayerscripts, everytime a player pressed the letter F, the baseplate color changes randomly here is the script: local Uis = game:GetService("UserInputService") local baseplate = game.Workspace:WaitForChild("Baseplate") if baseplate then print("baseplate is in Workspace") else warn("baseplate is not in Workspace") end Uis.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.F then print("F has been Pressed") local redValue = math.random(0, 255) local greenValue = math.random(0, 255) local blueValue = math.random(0, 255) baseplate.Color = Color3.fromRGB(redValue, greenValue, blueValue) end end)
@6xysh
@6xysh 15 дней назад
woahh
@TANER845
@TANER845 7 дней назад
show off
@DevRRG
@DevRRG 6 дней назад
@@TANER845 huh?
@seppmw5163
@seppmw5163 6 дней назад
That actually made sense
@truongvinh3386
@truongvinh3386 2 дня назад
​@TANER845 it's not showing off this person is a intermediate-pro dev, by them kindly sending these codes newer devs like me can learn too. Maybe ur just jealous cause u suck but it's not showing off
@MaximLankin
@MaximLankin 2 месяца назад
first time learning in depth i feel lowkey happy with this code i created a brick that randomizes color every time its touched with debounce that i had to search up how to do because i was frustrated that the colors kept changing as long as i touched the brick local brick = script.Parent local debounce = false brick.Touched:Connect(function(otherpart) local humanoid = otherpart.Parent:FindFirstChild("Humanoid") if humanoid and not debounce then debounce = true local redValue = math.random(0, 255) local greenValue = math.random(0, 255) local blueValue = math.random(0, 255) brick.Color = Color3.fromRGB(redValue, greenValue, blueValue) task.wait(1) debounce = false end end)
@liutenant-blob_pond
@liutenant-blob_pond 11 дней назад
So i decided to model a discord setup, a simple 3x3. i would use what we learnt from last video(Script.Parent) to relate to the part, adding it into the parts. eventually the script worked with 1, so i copied it into the others not needing to chnage(cuase the parent is changing), and.... IT WORKED. if you want to try this out for yyourself, or jus t wanna see the script, i used the same one from the video, here is the script: local color = script.Parent while true do local redValue = math.random(0,225) local blueValue = math.random(0,225) local greenValue = math.random(0,225) color.Color = Color3.fromRGB(redValue, blueValue, greenValue) task.wait(1) end
@Fast_gorilla
@Fast_gorilla 10 дней назад
Btw for the random baseplate color you dont have to do that just do this local baseplate = game.workspace.Baseplate local color = 1 baseplate.Touched:connect(function(change) while color < 5 do baseplate.BrickColor = Brickcolor.random() task.wait(1) end end)
@shodisk
@shodisk Месяц назад
local money = 1782300 local eggCost = 20000 while money >= eggCost do local chance = math.random(1, 100) if chance
@akuji9166
@akuji9166 Месяц назад
I wanna ask something the "if chance
@akuji9166
@akuji9166 Месяц назад
elseif chance
@elijah444
@elijah444 15 дней назад
I made a button that has a 1/10 chance to turn a screen yellow! Amazing tutorials btw
@Stickmangold360
@Stickmangold360 Месяц назад
i made gambling script in the gui local text = script.Parent text.Visible = false while true do local roll = math.random(1,6) print(roll) if roll == 6 then text.Visible = true end task.wait(2) text.Visible = false end
@ChipiChipiKAYRA
@ChipiChipiKAYRA Месяц назад
I did a script that picks a number between 1 and 8 and a text shows that number local RandomNumber = math.random(1, 8) local Text = game.Workspace.RandomNumberPart.SurfaceGui.TextLabel Text.Text = (RandomNumber)
@NotDanTGBalt
@NotDanTGBalt Месяц назад
I wanted to do something a bit more complex but it didn't work, and didn't stop using a particular number. And one time, it even crashed my game. This is the one I ended up with: local petOpening = math.random(1,5) if petOpening == 1 then print("You got a(n) [COMMON] Elephant (1/5)") end if petOpening == 2 then print("You got a(n) [COMMON] Dog (2/5)") end if petOpening == 3 then print("You got a(n) [UNCOMMON] ZEBRA (3/5)") end if petOpening == 4 then print("You got a(n) [LEGENDARY] DRAGON(4/5)") end if petOpening == 5 then print("You got a(n) [MYTHICAL] AZUNE(5/5)") end
@babyjacob_7855
@babyjacob_7855 3 месяца назад
i also love this local dice = math.random(1, 6) local d = math.random(1, 6) print("And The Dice Roll Is... ".. dice + d)
@JohnSminks
@JohnSminks 2 месяца назад
local baseplate = game.Workspace.Baseplate while true do local randomValue = math.random() baseplate.Transparency = randomValue if baseplate.Transparency > 0.9 then print("Wow, your baseplate is pretty dang transparent.") end task.wait(1) end
@Ismalellel
@Ismalellel 2 месяца назад
haha cool
@TropialGamingYT
@TropialGamingYT 2 месяца назад
The Root to Gambling Love it. Great video learned how to make a chance system and gamble...
@MdkerMdxer
@MdkerMdxer Месяц назад
6:35 u can also change the baseplate color using the following script local Baseplate = game.Workspace.Baseplate Baseplate.BrickColor = BrickColor.Random()
@SimplyTutuco
@SimplyTutuco 19 дней назад
BrickColor.Random() limits the amount of colors, now the way he did is absolutelly any color out of the over 765 the game has.
@frbestguy
@frbestguy 2 месяца назад
local baseplate = workspace:FindFirstChild("Baseplate") local function randomNum() local randomnumber = math.random(1, 4) if randomnumber == 1 then baseplate.Color = Color3.fromRGB(255, 90, 100) elseif randomnumber == 2 then baseplate.Color = Color3.fromRGB(100, 255, 100) elseif randomnumber == 3 then baseplate.Color = Color3.fromRGB(100, 100, 255) elseif randomnumber == 4 then baseplate.Color = Color3.fromRGB(255, 255, 100) end end local counter = 1 while counter
@ax4842
@ax4842 Месяц назад
i did a luckyblock local touchPart = game.Workspace["LuckyBlock"] local partIsTouched = false touchPart.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if partIsTouched == false then partIsTouched = true local result = math.random(1, 20) if result
@that-original-channel
@that-original-channel 26 дней назад
local rand = math.random(1, 32) local jackpot = 32 while true do if rand == jackpot then print("YOU HIT THE JACKPOT!") end task.wait(0.5) rand = math.random(1, 32) end
@MyUsersCool
@MyUsersCool 5 дней назад
I made a part when clicked, it sets the walk speed to a random number local speedrandomizer = game.Workspace.SpeedRandomizer local clickdetector = game.Workspace.SpeedRandomizer.ClickDetector clickdetector.MouseClick:Connect(function(player) local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then local numberforspeed = math.random(20, 200) humanoid.WalkSpeed = numberforspeed print("The Player Has A Speed Of:", numberforspeed) end end)
@truongvinh3386
@truongvinh3386 2 дня назад
Amazing work this is good stuff
@aapple7993
@aapple7993 3 месяца назад
--once brick touched, takes random amount of health, when touched again takes away from 0 - current health, part is rainbow local killBrick = script.Parent killBrick.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChild('Humanoid') if humanoid then humanoid.Health = math.random(0, humanoid.Health) print('You now have', humanoid.Health) task.wait(1) end end) while true do local redValue = math.random(0, 255) local greenValue = math.random(0, 255) local blueValue = math.random(0, 255) killBrick.Color = Color3.fromRGB(redValue, greenValue, blueValue) task.wait(1) end
@profishi.
@profishi. 3 месяца назад
Keep making these videos don't give up your video quality is amazing the whole developing community will eventually start loving you content and even beginners who need help keep up the good work and good luck
@rizzzzzlestudios5555
@rizzzzzlestudios5555 2 дня назад
good video 👍👍
@goodnoob857
@goodnoob857 2 месяца назад
best ever scriping tutorial I have seen
@Kirmizi_Domates
@Kirmizi_Domates 2 месяца назад
i did something like this for learning objective local part = script.Parent local colorChange = false local coolDown = false part.Touched:Connect(function(touched) local isHumanoidTouched = touched.Parent:FindFirstChild("Humanoid") if isHumanoidTouched and coolDown == false then colorChange = true if colorChange == true then local redRGB = math.random(0,255) local greenRGB = math.random(0,255) local blueRGB = math.random(0,255) part.Color = Color3.fromRGB(redRGB,greenRGB,blueRGB) colorChange = false coolDown = true task.wait(3) coolDown = false end end end)
@guttenjak
@guttenjak 3 месяца назад
(as always) great tutorial🎉, but how can I do this if I want a decimal number with a certain number of decimal places? (for example two)
@mathbrah
@mathbrah 3 месяца назад
uhm
@Mah_guy
@Mah_guy 2 месяца назад
this is a little rng game that i made! print("try to get 5 in the least tries possible!") local result = 0 variable2 = 0 function function1() variable2 = variable2 + 1 result = math.random(1,5) print(result) if result == 5 then variable3 = 1 else variable3 = 0 end if variable3 == 1 then print("lucky duck!") print(variable2, "tries!") else print("try again!") function1() end end if result == 0 then function1() end
@rodneysot
@rodneysot 2 месяца назад
local corner = script.Parent local Random = math.random(1, 12) corner.Touched:Connect(function(theOtherPart) local humanoid = theOtherPart.Parent:FindFirstChild("Humanoid") if humanoid then print (Random) end end)
@kruczak7896
@kruczak7896 2 месяца назад
This dice can only be rolled once local cube = script.Parent local randomRoll = math.random(1, 6) cube.Touched:Once(function(SnakeEyes) local RFoot = SnakeEyes.Parent:FindFirstChild("RightFoot") if RFoot then print(randomRoll) end end)
@miguelitto999
@miguelitto999 Месяц назад
basically this code will change the baseplate transparency every 1 second until it gets exacly 1 transparency local function baseplateTransparancy() local baseplate = game.Workspace.Baseplate if baseplate.Transparency == 0 then baseplate.Transparency = math.random() end wait(1) while baseplate.Transparency = 0.8 then print(baseplate.Transparency) print("So close but so far") end wait(1) end end baseplateTransparancy()
@therealjohnn5928
@therealjohnn5928 День назад
Cant you also do this? local baseplate = game.Workspace.Baseplate while true do baseplate.BrickColor = BrickColor.Random() wait(10) end
@fascinatingfaux811
@fascinatingfaux811 2 месяца назад
I was able to make some spheres that roll around a box and change colors every few seconds but I can’t paste the code since I’m not on the PC right now.
@stenkkujontunen29
@stenkkujontunen29 Месяц назад
You have helped me soo much with coding i really appriciate it and this is what i made. --[[ local KillBrick = script.Parent KillBrick.Anchored = true KillBrick.Material = ("Neon") KillBrick.Color = Color3.fromRGB(255, 255, 255) local Thingy = true KillBrick.Touched:Connect(function(Otherpart) local Humanoid = Otherpart.Parent:FindFirstChild("Humanoid") Thingy = false local Sigma = math.random(0, 100) print(Sigma) if Humanoid then Humanoid.Health = (Sigma) while Thingy == false do local Greenvalue = math.random(0, 255) local BlueValue = math.random(0, 255) local RedValue = math.random(0, 255) if Humanoid then KillBrick.Color = Color3.fromRGB(Greenvalue,BlueValue,RedValue) task.wait(2) Thingy = true if Thingy == true then KillBrick.Color = Color3.fromRGB(255, 255, 255) end end end end end) ]]
@chalmcal
@chalmcal 3 месяца назад
(warning, big code) chamber = math.random(1, 6) if chamber == 1 then print("you are dead") else print("you lived") print(chamber) task.wait(2) chamber = math.random(1,5) if chamber == 1 then print("you are dead") else print("you lived") print(chamber) task.wait(2) chamber = math.random(1,4) if chamber == 1 then print("you are dead") else print("you lived") print(chamber) task.wait(2) chamber = math.random(1,3) if chamber == 1 then print("you are dead") else print("you lived") print(chamber) task.wait(2) chamber = math.random(1,2) if chamber == math.random(1,2) then print("you are dead") else print("you have lived") print(chamber) end end end end end
@chalmcal
@chalmcal 3 месяца назад
I wasn't happy with that version so I improved it local gun = math.random(1, 6) local TheGame = script.Parent local fire = TheGame:FindFirstChild("fire") local spin = TheGame:FindFirstChild("spin") fire.Touched:Connect(function(otherpart) local humanoid = otherpart.Parent:FindFirstChild("Humanoid") if humanoid then if gun == 1 then humanoid.Health = 0 print("you died") else print("you lived") gun = gun - 1 task.wait(5) end else task.wait(5) end end) spin.Touched:Connect(function(otherpart) local humanoid = otherpart.Parent:FindFirstChild("Humanoid") if humanoid then gun = math.random(1, 6) print("coward") task.wait(5) end end)
@TheOnlyChunti
@TheOnlyChunti 2 месяца назад
and how is it useful?
@maxne55_66
@maxne55_66 Месяц назад
local baseplate = game.Workspace.Baseplate local repeats = 0 while repeats
@DBRMajinChame
@DBRMajinChame Месяц назад
GAMBLING RAHHH while true do wait("2") local Gambling = math.random(1, 150) print(Gambling) end
@rytcat
@rytcat 3 часа назад
If you get a small number you lose but if you get hight you win local rnb = math.random(1, 1000) local rnd = 1 game.Players.PlayerAdded:Connect(function(plr) task.wait(2) while rnd
@zenknight4839
@zenknight4839 Месяц назад
while true do local ranWord = math.random(0, 3) if ranWord == 0 then print("Stepanci") elseif ranWord == 1 then print("Caporetto") elseif ranWord == 2 then print("Somme") else print("Aisne") end task.wait(3) end Basically a map randomizer
@skyvis8653
@skyvis8653 6 дней назад
what i did -- local randomNumber = math.random(1,6) local basePlate = workspace.Baseplate while true do local redValue = math.random(0,255) local greenValue = math.random(0,255) local blueValue = math.random(0,255) basePlate.Color = Color3.fromRGB(redValue,greenValue,blueValue) if randomNumber == 6 then basePlate.Color = Color3.fromRGB(255, 217, 0) end task.wait(1) end
@cubingmaster666
@cubingmaster666 День назад
local function randomNum() local randomNumber = math.random(0,1000000) print(randomNumber) end for printedNum = 1, 100, 1 do randomNum() if randomNum() ~= 100000 or 200000 or 300000 or 400000 or 500000 then print("Not good enough.") end end try to get a 1 in 200,000 :)
@ibraheembinahmed-zh4wq
@ibraheembinahmed-zh4wq 2 дня назад
Here's my code: local CB = script.Parent --CB is a button made of cylinders that needs to change colors in a rainbow. See how I did that starting line 21 to 49. local gh = false --gh is just a random boolean variable used for the event. CB.Touched:Connect(function() if gh == false then gh = true local red = math.random(0, 255) local blue = math.random(0, 255) local green = math.random(0, 255) --I previously used BrickColor.Random() while experimenting with code but I switched to math.random() because of the tutorial. game.Workspace.Donut.Icing.Color = Color3.fromRGB(red, blue, green) task.wait(1) gh = false end end) --Here comes the color changing part. while true do CB.BrickColor = BrickColor.new("Pastel violet") task.wait(.5) CB.BrickColor = BrickColor.new("Dark indigo") task.wait(.5) CB.BrickColor = BrickColor.new("Electric blue") task.wait(.5) CB.BrickColor = BrickColor.new("Lime green") task.wait(.5) CB.BrickColor = BrickColor.new("New Yeller") task.wait(.5) CB.BrickColor = BrickColor.new("Bright orange") task.wait(.5) CB.BrickColor = BrickColor.new("Really red") task.wait(.5) end --Every 0.5 seconds the color changes.
@yonosaboluis
@yonosaboluis 2 месяца назад
took a little minute to figure out but this has the block randomly move local brick = game.Workspace.brick while true do local xValue = math.random(-1, 1) local yValue = math.random(-1, 1) local zValue = math.random(-1, 1) brick.Position = Vector3.new(xValue, yValue, zValue) task.wait(1) end
@billtimmy-p4g
@billtimmy-p4g 2 дня назад
proximityprompt = script.Parent script.Parent.Triggered:Connect(function(player) local Character = player.Character local humanoid = Character:FindFirstChild("Humanoid") local s = math.random(1,3) if s == 3 then humanoid.BodyWidthScale.Value += 5 elseif s == 2 then humanoid.BodyDepthScale.Value += 5 elseif s == 1 then humanoid.BodyHeightScale.Value += 5 elseif s == 4 then humanoid.BodyHeadScale.Value += 5 end print(s) end) keep in mind that this script is parented to a proximity prompt
@mysteriousban1956
@mysteriousban1956 Месяц назад
local brick = game.Workspace.Brick while true do local random = math.random() brick.Transparency = random print(random) if brick.Transparency
@aeroFSS
@aeroFSS 2 месяца назад
local bs = game.Workspace.Baseplate while true do local baseplateTransparency = math.random(0, 1) bs.Transparency = baseplateTransparency wait(.5) end
@NoM0v1NgcH4NneLs9w_
@NoM0v1NgcH4NneLs9w_ 2 месяца назад
-- LEARNING OBJECTIVE: local function roll() local randomNumber = math.random(0, 1000) if randomNumber >= 0 and randomNumber < 700 then print("COMMON!") elseif randomNumber >= 700 and randomNumber < 900 then print("RARE!!") elseif randomNumber >= 900 and randomNumber
@soyyoluca5248
@soyyoluca5248 14 дней назад
I wrote a script for a brick that changes your walkspeed to a random value each time you touch it! local randomPart = game.Workspace.RandomPart local isTouched = false randomPart.Touched:Connect(function(otherPart) if isTouched == false then isTouched = true local humanoid = otherPart.Parent:FindFirstChild("Humanoid") local walkspeedRandom = math.random(8, 64) humanoid.WalkSpeed = walkspeedRandom task.wait(1) isTouched = false end end) thanks for the video
@Ggwinziscool
@Ggwinziscool 2 месяца назад
i made a RNG using prints, is there any way i can make this shorter? local RNG = math.random(1, 16) print(RNG) if RNG == 1 then print("you got a common") end if RNG == 2 then print("you got an uncommon") end if RNG == 3 then print("you got a rare") end if RNG == 4 then print("you got an epic") end if RNG == 5 then print("you got a legendary!") end if RNG == 6 then print("you got a mythic!") end if RNG == 7 then print("you got a destroyer!") end if RNG == 8 then print("you got a crazy!!!") end if RNG == 9 then print("YOU GOT ERROR!") end if RNG == 10 then print("you got a black hole!!?!?!") end if RNG == 11 then print("you got a nebula!") end if RNG == 12 then print("you got a DEATH!") end if RNG == 13 then print("you got a heaven!") end if RNG == 14 then print("you got a SUN!") end if RNG == 15 then print("you got a BREAKAGE!") end if RNG == 16 then print("you got a mentally unstable lol") end
@ansjsj3ensudka
@ansjsj3ensudka 2 месяца назад
local messages = { [1] = "you got a common", [2] = "you got an uncommon", [3] = "you got a rare", [4] = "you got an epic", [5] = "you got a legendary!", [6] = "you got a mythic!", [7] = "you got a destroyer!", [8] = "you got a crazy!!!", [9] = "YOU GOT ERROR!", [10] = "you got a black hole!!?!?!", [11] = "you got a nebula!", [12] = "you got a DEATH!", [13] = "you got a heaven!", [14] = "you got a SUN!", [15] = "you got a BREAKAGE!", [16] = "you got a mentally unstable lol" } local RNG = math.random(1, 16) print(RNG) print(messages[RNG])
@kirillo4137
@kirillo4137 Месяц назад
I made a slots machine, if you get any 3 numbers together you will get a small prize, and if all 3 numbers are 7's then you will get a jack pot. a single 10 will grant you a free spin and non matching numbers will respond with bad luck local value1 = math.random(1, 10) local value2 = math.random(1, 10) local value3 = math.random(1, 10) if true then print(value1, value2, value3) end if value1 == 7 and value2 == 7 and value3 == 7 then print("Jackpot!") elseif value1 == value2 and value2 == value3 then print("You got a small prize!") elseif value1 == 10 or value2 == 10 or value3 == 10 then print("You got a free spin!") else print("Bad luck!") end
@Thekingofbees12
@Thekingofbees12 8 дней назад
I made it so everytime you touch a part it will change to a random color local touchPart = game.Workspace["Touch Part"] local partIsTouched = false touchPart.Touched:Connect(function(otherpart) if not partIsTouched then partIsTouched = true local red = math.random(0,255) local green = math.random(0,255) local blue = math.random(0,255) touchPart.Color = Color3.fromRGB(red, green, blue) task.wait(.85) partIsTouched = false end end)
@klabur768
@klabur768 Месяц назад
I"ve made a basic spin system with currency using math.random local button = script.Parent:FindFirstChild("TextButton") local textBox = script.Parent:FindFirstChild("Text") local currency = 1000 local currencyDisplay = script.Parent:FindFirstChild("TextLabel") currencyDisplay.Text = tostring(currency) function spin() if currency >= 100 then currency = currency - 100 currencyDisplay.Text = tostring(currency) local rate = math.random(1, 100) if rate 50 and rate 70 and rate 90 and rate 99 and rate
@raknarog8113
@raknarog8113 Месяц назад
local Speed = script.Parent Random Velocity Speed Pad ( Important you need to insert the script in a part obviously): Speed.Touched:Connect(function(Speed) local humanoid = Speed.Parent:FindFirstChild("Humanoid") if humanoid then local randomSpeed = math.random(1, 3) task.wait(0.5) if randomSpeed == 1 then humanoid.WalkSpeed = 1 elseif randomSpeed == 2 then humanoid.WalkSpeed = 70 elseif randomSpeed == 3 then humanoid.WalkSpeed = 200 end task.wait( 8) humanoid.WalkSpeed = 16 end end)
@pedroj.8013
@pedroj.8013 25 дней назад
I made a block that every time a player touches it, it will be printed that he got an item, and the rarity of that item can be different local part = script.Parent local verify = true part.Touched:Connect(function(obj) if obj.Parent.Humanoid then part.CanTouch = false while verify == true do verify = false local rarity = math.random(1, 100) if rarity >= 40 then print("You got a common item") elseif rarity >= 25 then print("You got an uncommon item") elseif rarity >= 10 then print("You got a rare item) elseif rarity >= 2 then print("You got a very rare item") else print("You got a legendary item) end end task.wait(2) verify = true part.CanTouch = true end end)
@1137guy
@1137guy 3 дня назад
local Hakari = 10 local Kashimo = 53420.43 while Hakari < Kashimo do if Hakari > Kashimo then break else Hakari = math.random(0, 1000) if Hakari == 777 then print(Hakari) Hakari = Hakari * 777 print("Hakari Hits Jackpot!") task.wait(5) continue end print("Doman expansion: Failed!") task.wait(0.05) end end print("Hakari beats kashimo!") print(Hakari)
@ItglBna
@ItglBna 2 месяца назад
9:11 he he he
@expir3
@expir3 9 дней назад
local petRandomiser = math.random(1, 10) if petRandomiser
@snothemonke
@snothemonke 17 дней назад
displays a random number on a textlabel local text = script.Parent.SurfaceGui.TextLabel local random = math.random(1, 100) text.Text = random
@ServantSinister
@ServantSinister Месяц назад
-- code changes baseplate's color and material every 5 seconds local baseplate = game.Workspace.Baseplate while true do local redValue = math.random(0, 255) local greenValue = math.random(0, 255) local blueValue = math.random(0, 255) baseplate.Color = Color3.fromRGB(redValue, greenValue, blueValue) if math.random(1, 4) == 1 then baseplate.Material = "Wood" elseif math.random(1, 4) == 2 then baseplate.Material = "Marble" elseif math.random(1, 4) == 3 then baseplate.Material = "Plastic" else baseplate.Material = "Neon" end task.wait(5) end
@VOP_FD_Videos
@VOP_FD_Videos 2 месяца назад
local part = game.Workspace.Part while true do local Value = math.random(1,2) if Value == 1 then part.CanCollide = false elseif Value == 2 then part.CanCollide = true end end
@phil9133
@phil9133 2 месяца назад
this almost took me 3 days to get to this episode cuz of school, and this is what I made. local randomColor = math.random(1, 100) print(randomColor) if randomColor
@Quirl-zz7fn
@Quirl-zz7fn Месяц назад
I made a rng based appearing part :0 local RNGBASEDPART = game.Workspace.Part RNGBASEDPART.Transparency = 1 math.random(1, 10) if 10 then RNGBASEDPART.Transparency = 0 print("YOU LUCKY FELLA") end Also can somebody help me with the parent and firstchild thing? I rewatched it like 2 times and kind of understand some things????
@RaptorClaus0_0690
@RaptorClaus0_0690 Месяц назад
"a six-sided die and when we roll this die its going to land on a number between 1 and 6" OH REALLY
@Stream7812
@Stream7812 3 дня назад
⭐This is script for greeting player differently local case = math.random(1,3) game.Players.PlayerAdded:Connect(function(player) - - Call player if case == 1 then print("Hello") elseif case == 2 then print("Hi") else print("Hey") end - - Player name print(player) end)
@RexMarket
@RexMarket 3 месяца назад
here's something i made using random local speed2 = script.Parent local humanoid = false speed2.Touched:Connect(function(otherpart) local humanoid = otherpart.Parent:FindFirstChild("Humanoid") if humanoid then speed2.BrickColor = BrickColor.new("Neon green") wait(1) humanoid.WalkSpeed = math.random(0 , 500) wait(5) humanoid.WalkSpeed = 16 wait(2) speed2.BrickColor = BrickColor.new ("Really red") wait(1) local humanoid = false end end) speed2.Anchored = true
@Potato-d5b
@Potato-d5b 2 месяца назад
btw you do know that you can anchor the part (speed2) from properties right?
@NoobieRoblox
@NoobieRoblox 26 дней назад
To change the baseplate to a random value easier I just did: Local baseplate = game.Workspace.Baseplate while true do baseplate.BrickColor = BrickColor.Random() task.wait(2) baseplate.BrickColor = BrickColor.Random() task.wait(2) end --[[ i dont think u have to add "baseplate.BrickColor = BrickColor.Random()" twice but i did anyway ]]
@SimplyTutuco
@SimplyTutuco 19 дней назад
It changes to a random value more easily, but it has very, VERY few colors. With the method he did, it's an absolutely random color that every single digit is gonna matter, not just like, a few dozen preset colors to be chosen.
@Snow-mw5jm
@Snow-mw5jm Месяц назад
local stud = script.Parent while task.wait(1) do scaryRNG = math.random(0,1) stud.Transparency = scaryRNG end
@edrildignos8348
@edrildignos8348 2 месяца назад
is this good? the baseplate changes color when you got the corresponding numbers m=game.Workspace.Baseplate local randomNumber = math.random(1, 6) print(randomNumber) if randomNumber == 3 then m.BrickColor = BrickColor.new("Grime") end if randomNumber == 1 then m.BrickColor = BrickColor.new("Really red") end
@Normise
@Normise Месяц назад
Here's a code that I made to change the size of a sphere. local ball = script.Parent ball.Touched:Connect(function(Toucher) local humanoid = Toucher.Parent:FindFirstChild("Humanoid") if humanoid then local size1 = math.random(1, 10) local size2 = math.random(1, 10) local size3 = math.random(1, 10) ball.Size = Vector3.new(size1, size2, size3) end end)
@Timuçinn1
@Timuçinn1 2 месяца назад
local baseplate = game.Workspace.Baseplate while true do local transparencyValue = math.random() baseplate.Transparency = (transparencyValue) print(transparencyValue) task.wait(2) end
@jakobmanton6889
@jakobmanton6889 21 день назад
Made a script to change the material on a big sphere local sphere = script.Parent while true do local randomNumber = math.random(1,3) if randomNumber == 3 then sphere.Material = "Plastic" elseif randomNumber == 2 then sphere.Material = "Metal" else sphere.Material = "Wood" end task.wait(5) end
@babyjacob_7855
@babyjacob_7855 3 месяца назад
local dice = math.random(1, 6) print("And The Dice Is... ".. dice) this is my favorite code cuz it says And the dice is (1 2 3 4 5 or 60
3 месяца назад
local myPart = script.Parent while true do local randomNumber = math.random(0, 1) myPart.Transparency = randomNumber task.wait(2) end
@bobuxcartel4051
@bobuxcartel4051 Месяц назад
while true do local pull = math.random(1, 100) if pull
@emerald8784
@emerald8784 Месяц назад
Heres the code i made using math.random local Part1 = game.Workspace.Part local Baseplate1 = game.Workspace.Baseplate local Debounce = false Baseplate1.Touched:Connect(function(hit) local Position1 = math.random(1,50) local Position2 = math.random(1,10) local Position3 = math.random(1,50) if Debounce == false then Debounce = true Part1.Position = Vector3.new(Position1, Position2, Position3) Part1.BrickColor = BrickColor.random() task.wait(.5) Debounce = false end end)
@Thekingofbees12
@Thekingofbees12 8 дней назад
Who else got 2 first try when testing random?
@reaklaz
@reaklaz 2 месяца назад
simplified rng code i think: you can also add particle if you know how to but i dont so yea ig while true do Aura = math.random(1, 99) task.wait(1.5) if Aura == 1 then print("good job mate,", Aura) elseif Aura
@JupiterPlays7
@JupiterPlays7 29 дней назад
POV: people making luck-based games 😳
@cyrex6261
@cyrex6261 10 дней назад
while true do local redvalue = math.random(0, 255) local greenvalue = math.random(0, 255) local bluevalue = math.random(0, 255) baseplate.Color = Color3.fromRGB(redvalue, greenvalue, bluevalue) print(redvalue) print(greenvalue) print(bluevalue) task.wait(5) end
@alizbalizsecret
@alizbalizsecret Месяц назад
Here is the barebone Hatching system i made: local randomNumber = math.random(0,100) if randomNumber
@SimplyTutuco
@SimplyTutuco 19 дней назад
A randomizer tends to pick bigger numbers, so the smallest number should be the rarest.
@RealKyklops
@RealKyklops Месяц назад
Does anyone know what's wrong with my code? I tried to make a killbrick that only kills you if upon touching it, its red value is higher than the other values. However, as soon as the red value is higher than the other values even once, it'll continuously kill you upon touching it, even if later on the brick is completely blue. local model = script.Parent local part1 = model:FindFirstChild("Part1") while true do wait(2) local redValue = math.random(0, 255) local greenValue = math.random(0, 255) local blueValue = math.random(0, 255) part1.Color = Color3.fromRGB(redValue, greenValue, blueValue) part1.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if redValue >= greenValue and redValue >= blueValue and humanoid then humanoid.Health = 0 else print("The redValue was lower, you're safe.") end end) end
@expir3
@expir3 9 дней назад
local baseMaterial = game.workspace.Baseplate local randomNumber = math.random(1, 2) if randomNumber == 2 then baseMaterial.Transparency = 0.1 wait(0.5) baseMaterial.Transparency = 0.2 wait(0.5) baseMaterial.Transparency = 0.1 wait(0.5) baseMaterial.Transparency = 0.2 wait(0.5) baseMaterial.Transparency = 0.1 wait(0.5) baseMaterial.Transparency = 0.2 wait(0.5) baseMaterial.Transparency = 0.1 end
@PODATO_DEVICE_USER
@PODATO_DEVICE_USER Месяц назад
took me 30 minutes to relize that i needed the local in the loop local ww = game.Workspace.r while ww.CastShadow == true do local r = math.random(0, 255) local b = math.random(0, 255) local g = math.random(0, 255) game.Workspace.Part.Color = Color3.fromRGB(r,g,b) task.wait(0.1) end
@MemeMasterPepe
@MemeMasterPepe 12 дней назад
i love playing counter strike so using math.random i created a script that simulates you opening a case in the game and tells you what item you got :) local printed = false while true do local cs2Case = math.random(1, 400) if not printed then if cs2Case >= 1 and cs2Case = 321 and cs2Case = 385 and cs2Case = 397 and cs2Case
@shiver8191
@shiver8191 Месяц назад
Made a script that changes a part color if u click it local part = script.Parent.Parent local clickDetector = script.Parent local function onMouseClick() local redValue = math.random(0,255) local greenValue = math.random(0,255) local blueValue = math.random(0,255) part.Color = Color3.fromRGB(redValue, greenValue, blueValue) end clickDetector.MouseClick:Connect(onMouseClick)
@lordshrek1561
@lordshrek1561 8 дней назад
local randomN = math.random(1, 6) if randomN == 6 then print("Your lucky!") else print("Ah man") end
@Ecaw
@Ecaw 2 месяца назад
I don't really understand this one. I tried making it change transparency along with the color, but it wouldn't change the transparency. Anyone mind helping and giving an explanation along wiith it? Thank you. local randomTransparencyPart = game.Workspace.RandomPart while true do local transValue = math.random(0, 1) randomTransparencyPart.Transparency = transValue task.wait(2) end
@utmdreams
@utmdreams 2 месяца назад
I don't know much but i think that if there are 2 loops, the script goes through only one at a time and since while true do runs indefinitely, the script wont look for the transparency script
@ansjsj3ensudka
@ansjsj3ensudka 2 месяца назад
math.random() generates a number between 0 and 1by default so you can just do math.random()
@SimplyTutuco
@SimplyTutuco 19 дней назад
You have to each loop in a separate script, since we didn't learn yet how to simultaneously run 2 loops in the same script yet.
@Ganondorf01
@Ganondorf01 3 месяца назад
local randomNum = math.random(1, 2) print(randomNum) local baseplateColor = game.Workspace.Baseplate local function gold () if randomNum == 2 then print("Congrats! You found gold!") task.wait(1) baseplateColor.BrickColor = BrickColor.new("Gold") end end gold() I was very proud when I got this to work
Далее
Can 6 DEVS Make a HANGOUT Game Without Communicating?
17:25
WORST vs BEST Rated Flight Simulators In ROBLOX
12:03
How This Roblox Game Created Itself (Technically)
18:28
How I Would Start Game Development (If I Started Over)
16:59
Roblox Code Review: Miner's Haven
16:59
Просмотров 89 тыс.
3 Hours vs. 3 Years of Blender
17:44
Просмотров 5 млн
Disturbing ROBLOX Games That Traumatized Me
12:59
Просмотров 187 тыс.
DON'T Make a Roblox Game Without Watching This First.
27:20
I Learned How to SCRIPT in 7 Days | Roblox
11:00
Просмотров 117 тыс.
Classic Roblox Games: How Are They Doing?
17:09
Просмотров 376 тыс.
The Most Impressive Scratch Projects
11:00
Просмотров 4,9 млн