Time: <none>

  • 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 community!

    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!

AlliSighs

Member
Feb 12, 2024
41
0
6
Code:
command /start:
    trigger:
        set {started::%player's uuid%} to now
        set {run::%player's uuid%} to true
        while {run::%player's uuid%} = true:
            wait 1 second
            set {_time} to difference between {started::%player's uuid%} and now
            send title "&a" with subtitle "&bTime: &f%format({_time})%" to player

function format(time: text) :: text:
    replace all "minutes" in {_time} with ": "
    replace all "seconds" in {_time} with ""
    return {_time}

1709978194989.png


Pls help me
 
The function used here doesn't work because the function just sees {_time} as a paremeter.
Its the same as using {_text} or {_chickenwing} or something like that. Setting {_time} to something in the /start command has no impact on the function (or any other event, for that matter). To revise this you would simply move that line to the function rather than the command.
Python:
command /start:
    trigger:
        set {started::%player's uuid%} to now
        set {run::%player's uuid%} to true
        while {run::%player's uuid%} = true:
            send title "&a" with subtitle "&bTime: &f%format({_time})%" to player
            wait 1 second

function format(time: text) :: text:
    set {_time} to difference between {started::%player's uuid%} and now
    replace all "minutes" in {_time} with ": "
    replace all "seconds" in {_time} with ""
    return {_time}