How do you make it so that if you do something at a specific time it will happen but if it's not at the specific time it won't happen
For example I think that if I use 'while' than it would go like local brick = game.Workspace. brick while brick.BrickColor == red than (Whatever I want to happen for example click e to do an animation Also I'm not requesting, I'm asking for a method.
This is a very simple question. So there is an extremely easy way to do this! There a connection called .Changed that every instance in roblox has! Look below to see how we'll use this!
local brick = workspace.brick -- The brick! "workspace" is a shortcut for "game.Workspace" function loopityLoop() -- The function we'll use later! end brick.Changed:connect(loopityLoop) -- The "Changed" is called whenever an element in "brick" changed!
So, you may be wondering "What Now?!?!" Well let's look below to find out! If you need to see more about brick color, go here
local brick = workspace.brick function loopityLoop() while brick.BrickColor = BrickColor.Red() do -- The loop that will run until "brick.BrickColor" isn't red anymore! (Also "BrickColor.Red()" is the bright red color!) -- Your code stuffz goes here! wait() -- Used so studio nor Roblox will crash! end end brick.Changed:connect(loopityLoop)
Hopefully this will suit your needs and that is has shed some more light on the cool shortcuts you can use in roblox!