Solved Night Time

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

ArthurMorgan

New Member
Dec 1, 2020
6
0
1
25
I am trying to make a skript where if two or more players are sleeping at night, the time automatically sets to morning, but I am struggling on how to script it. Can someone type the skript on how to make that work? Thank you

What I wrote:
at 18:00:
if two or more players are sleeping:
set time to day
-----------------------
The error is at line 2, cannot understand this condition
 
There is nothing like "players sleeping".
However, you can count players in the bed using a variable:
Code:
on bed enter:
    add 1 to {inbed}
on bed leave:
    remove 1 from {inbed}
Then, you can get the number of sleeping players from the variable:
Code:
at 18:00:
    if {inbed} >= 2:
        #do your code
Also, it only checks once a day. Are you sure you want to do it only like so?
 
  • Like
Reactions: ArthurMorgan
There is nothing like "players sleeping".
However, you can count players in the bed using a variable:
Code:
on bed enter:
    add 1 to {inbed}
on bed leave:
    remove 1 from {inbed}
Then, you can get the number of sleeping players from the variable:
Code:
at 18:00:
    if {inbed} >= 2:
        #do your code
Also, it only checks once a day. Are you sure you want to do it only like so?
Thank you for your help, it worked.
 
Status
Not open for further replies.