Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help? I don't know how I would do this.

Asked by 10 years ago

How would I make a script, that waits 100 seconds, but also if only 1 person has an ingame boolvalue true, will skip the rest of the time, or if all the players boolvalues = false?

1 answer

Log in to vote
1
Answered by
duckwit 1404 Moderation Voter
10 years ago

Assuming the BoolValue Object is stored under Backpack in the Player that you want to run this test for:

wait(100) --This function yields the current thread for however many seconds you put in

player = game.Players["NameOfPlayerHere"]

if player.Backpack["NameOfBoolValueHere"].Value then
    --It's true! :)
else
    --It's false! :(
end

Notice that there are various ways to write a truth test for boolean data types in Lua, namely:

if value then

if value == true then

if value == 1 then

if value ~= false then

if value ~= 0 then

But, personally I think if value then is the most elegant ;)

0
I need it to wait 100 seconds, but also if only one players BoolValue == true, then it will skip the rest of the time. This really doesn't help, sorry :( systematicaddict 295 — 10y
0
He's giving you a template on how to write it yourself. It doesn't help you learn if you're hand-given completed code like a toddler. Apply what he's saying to your problem and use your human intellect to create code. OniiCh_n 410 — 10y
0
I don't agree with how zMatrix worded it, but he is right - Scripting Helpers is about helping people to put scripts together, not scripting for them! I may post another answer a bit later that answers more of your question though. duckwit 1404 — 10y
Ad

Answer this question