#I want to make it so that when playing==false the loop stops until playing is back on

1 messages · Page 1 of 1 (latest)

dark oasis
#

while playing==true do
    wait(2)
    local choose = math.random(1, 6)
    if choose == 1 then
        text.Text = "Red"
        RedParts.Parent=workspace
        text.TextColor3=Red
            text.Parent.BackgroundColor3=Red

        wait(2)
        PurpleParts.Parent=rs
        RedParts.Parent=workspace
        BlueParts.Parent=rs
        GreenParts.Parent=rs
        YellowParts.Parent=rs
        OrangeParts.Parent=rs
    elseif choose == 2 then--continuses the same proccess with a different color blah blah blah

    end```
#

It works fine regularly but whenever I use the Boolean value to turn it on and off the script breaks, only thing I can think of is putting it as a remote event in my timer script(which is the one that togles playing on/off) sad sad sad

opaque flicker
#

use getpropertychangedsignal to detect when playing value changes

dark oasis
#

I tried that with an if statement inside as well but it still gave me the same results as the way displayed In the script I sent(the script breaking) except if you mean putting it next to the if choose==1 then like if choose==1 and playing==true then

opaque flicker
#

a while loop is gonna stop and never run again after playing == false

dark oasis
#

Shit that's mb then

opaque flicker
#

also instead of a bunch of if statements for choose you could use a table

dark oasis
#

I know

opaque flicker
#

something like
local colours = {red, blue, yellow, etc}

#

then text.Text = colors[choose]

dark oasis
#

The game logic is shitty ah indeed I'm just focusing on getting this thing to actually work first and then I'm tidying it up

opaque flicker
#

workspace[colors[choose].."Parts"].Parent = workspace

#

no sense in writing code you know is shitty to clean it up later, might as well clean it the first time so you can focus on what doesnt work

dark oasis
dark oasis
sinful kayak
# dark oasis ```local playing=game:GetService('ReplicatedStorage').playing.Value while playi...

First of all, saving a value to a variable like this won’t actually update when the value is changed, it will store the initial value and won’t update no matter if the actual value is changed or not

Second of all, just use while true do and in the while loop add an if statement to check if playing.Value is true, then execute code.

This way you just do nothing until playing == true and then you enter the if statement

dark oasis
#

@s... hey could u help me out here ive never used GetPropertyChangedSignal() before but this is defo wrong ```local cdown = game.ReplicatedStorage:WaitForChild("cdown")
cdown:GetPropertyChangedSignal('Value'):Connect(function(property)
while true do
if cdown.Value==false then
reset()
wait()
else
wait(2)--rest of the script

opaque flicker
#

no bro so unperformant, use getpropertychanged so its only running when you actually want it to

#

im gonna spoonfeed cuz this is making me tweak

dark oasis
#

also i should prolly just get to cleaning up the script first as mentioned...

#

shit what am i even doiing w the property paramater O.o

opaque flicker
#
local colours = {"Red", "Yellow", "Blue"}
local playing = game.ReplicatedStorage:WaitForChild("playing")
local partsfolder = game.ServerStorage.PartsFolder
local partsfolderinit = partsfolder:GetChildren() --idk whereever u keep the parts

playing:GetPropertyChangedSignal("Value"):Connect(function(property)
local choose = math.random(1, 6)
if playing.Value == true then
task.wait(2)--idk why u have this but i kept it
text.Text = colours[choose]
task.wait(2)
for i, parts in partsfolderinit do
parts.Parent = partsfolder
end
partsfolderinit[colours[choose].."Parts"].Parent = workspace
--i dont think u can just do Color3 = Red but idk maybe u can
end
end)
dark oasis
#

very generous of u coolguy

dark oasis
sinful kayak
#

It works for everyone else, why wouldn’t it work for you

sinful kayak
dark oasis
# sinful kayak Dude what I’m here trying to help Its not my problem right? I could’ve just ig...

You did not show much respect either so why would I? "It works for everyone else, why wouldn’t it work for you" is also pretty rude imo, If you do not find it rude then well, what I sent, it's just a GIF, not that deep lol. I got what u said the first time when you said I implemented it wrong, you act like I'm one of those kids with 0 scripting knowledge under scripting tutorials that just copy the whole code and then cry and hate on the guy who uploaded the video as if it just happened to work for the creator but not them, I also have shit knowledge, I started in January, when I even had the time to script but I'm trying my best, I did mention I used an if statement before u even pointed it out so least u could do would be to just help me instead of shitting on me, perchance. notcoolguy notcoolguy notcoolguy notcoolguy

sinful kayak
# dark oasis You did not show much respect either so why would I? "It works for everyone else...

I am not shitting on you, but confidently ruling out my solution that works, and i know for a fact that it works, is.. not very respectful either. I did not disrespect you before you did it to me.

Now, i don’t hate on anybody, i just don’t like your attitude to people trying to help. Maybe you could share what you made so i could help you discover the issue, instead of writing a pragraph of how disrespectful i am for trying to help.

And i never said anything about you having no knowledge.

dark oasis
#

I still think your initial response was rude and I was in the right; I was definitely not ruling out your solution , if anything I was just expecting u to guide me on what's going wrong ... The having no knowledge part was just an addition to what I was saying about you treating me like a kid with 0 scripting knowledge or will to learn and whatever else I wrote... Anyway, I apologise for coming out a bit rude, although it's really just a GIF in response to u being disrespectful first, and I think my attitude before that gif was fine.

Everything aside, I'll just apologise for good here; I'm sorry for being rude. Ta da.

#

Sorry I'm not good at apologising sad sad I swear it's just that I'm acc sorry

#

Anyway, if u hopefully accept my apology then I'm not on my laptop right now but idk a bit unorthodox I guess, I basically have a timer script for the intermission and I just made it disable that script each time the playing is false, instead of changing it through the script itself, maybe a weird approach but it's getting the job done, until I maybe find a more reliable approach.

opaque flicker
#

i literally gave u the code and u used a scuffed solution instead

dark oasis
#

i just didnt know how to incorporate that into my script + i have shit knowledge about in pairs loops, i just got back on my laptop so ofc id consider ur script sowwy

sinful kayak
pure tree
# dark oasis i just didnt know how to incorporate that into my script + i have shit knowledge...

DISCORD 📜
Join my Discord Community if you want scripting help, participate in events/challenges, and make friends!
https://discord.gg/WC6kPu5W5P

MEMBERSHIPS 🎁
Get Access To My Scripts + More Perks By Becoming a Channel Member! 👇
https://www.youtube.com/@BrawlDevRBLX/join

BEGINNER ROBLOX SCRIPTING SERIES 🟢
https://youtube.com/playl...

▶ Play video
dark oasis
#

srry ill text in a bit im tidying up the scripts

dark oasis
#

part.Parent=workspace:FindFirstChild(nameRandom..'Parts')

#

would this b correct to parent to parent eg if the color is Red to a folder name RedParts

#
local Green = Color3.new(0.333333, 0.666667, 0)
local Blue = Color3.new(0, 0, 1)

local folder=Instance.new('Folder')
folder.Parent=workspace
folder.Name='RedParts'
for i,v in pairs(workspace:GetDescendants()) do
    if v:IsA('Part') and v.Name=='Red' then
        v.Parent=folder

    end
end```
#

this was my initial script

#

but it wouldn't work for some reason it just created the folders in the workspace

#

Name Random is the string of the colour name and then I merged it with 'Parts' to find the folder in the workspace but it would turn out really broken

#

Anyway I cleaned up the first script, got a better understanding of in pairs loops as well in the mean time but my laptop ran out of battery again 💔💔

#

And now the colour changing block thingy got messed up so... sad sad

#

maybe I'll just continue with my if loop spam masterpiece

dark oasis
#

ok it worked nvm

dark oasis
#

nvm it didnt