I wanted to know if there is a way, you can tell the script what was printed.
Example:
How will I tell the script what was printed? like an if statement?
Example:
how will I tell the script, that cheese was printed
I wanted to know if there is a way, you can tell the script what was printed.
Example:
How will I tell the script what was printed? like an if statement?
Example:
how will I tell the script, that cheese was printed
When doing the math.random() part, set it to a variable and then print the variable and then you know what was printed.
game:GetService("LogService").MessageOut:Connect(function(Message)
print(Message)
end)
Zamn, didn’t even know that existed.
so basically if you print something it will just repeat printing it
i know what ur thinking, it wont gonna repeat inf cuz it prints again Xd
Do what @TaxFraudBruh said above
local foods = {"Egg","Cheese","Bread"}
local SelectedFood --This variable contains your
wait(5)
SelectedFood = foods[math.random(#foods)]) --Sets the variable to your selected food
print(SelectedFood)
Everyone’s reply helped me alot! But I’m thinking something like:
local foods = {"Egg", "Cheese", "Bread"}
wait(5)
print(foods[math.random(#foods)])
if "printed" = Egg then
...
local foods = {"Egg", "Cheese", "Bread"}
wait(5)
local selected = (foods[math.random(#foods)])
print(selected)
if selected = "Egg" then
...
local foods = {"Egg", "Cheese", "Bread"};
local chosenFood = nil;
task.wait(5);
chosenFood = (foods[math.random(#foods)]);
if chosenFood = "Egg" then
print"isEgg" ;
elseif chosenFood = "Cheese" then
print"isCheese";
else
print"anything";
...
Thanks everyone! This is a big help, everyone’s replys are helpful! Have a good day/night!