What is wrong with this User profile script

:local u $user
:if ([:len $u] = 0) do={ :return }

:local mac $"mac-address"
:if ([:len $mac] = 0) do={ :return }

:local uid [/ip hotspot user find where name=$u]
:if ([:len $uid] = 0) do={ :return }

Sanitize username for scheduler names

:local safeU [:tostr $u]
:set safeU [:replace $safeU " " ""]
:set safeU [:replace $safeU ":" "
"]
:set safeU [:replace $safeU "/" ""]
:set safeU [:replace $safeU "\" "
"]
:set safeU [:replace $safeU ";" ""]
:set safeU [:replace $safeU "." "
"]
:set safeU [:replace $safeU "@" "_"]

:local schedClock ("expC24-" . $safeU)
:local schedUp ("expU24-" . $safeU)

MAC lock once

:local curMac [/ip hotspot user get $uid mac-address]
:if ($curMac = "") do={ /ip hotspot user set $uid mac-address=$mac }

Create schedulers only once

:if ([:len [/system scheduler find where name=$schedClock]] = 0) do={
:if ([:len [/system scheduler find where name=$schedUp]] = 0) do={

:local d [/system clock get date]
:local t [/system clock get time]

/system scheduler add name=$schedClock start-date=$d start-time=$t interval=1d on-event=(
    ":local uu \"" . $u . "\";"
  . ":local sc \"" . $schedClock . "\";"
  . ":local su \"" . $schedUp . "\";"
  . "/ip hotspot active remove [find where user=\$uu];"
  . "/ip hotspot user set [find where name=\$uu] disabled=yes;"
  . ":local c [/ip hotspot user get [find where name=\$uu] comment];"
  . ":if ([:find \$c \"EXPIRED |\"] = nil) do={ /ip hotspot user set [find where name=\$uu] comment=(\"EXPIRED | \" . \$c); }"
  . "/system scheduler remove [find where name=\$sc];"
  . "/system scheduler remove [find where name=\$su];"
)

/system scheduler add name=$schedUp start-date=$d start-time=$t interval=1m on-event=(
    ":local uu \"" . $u . "\";"
  . ":local sc \"" . $schedClock . "\";"
  . ":local su \"" . $schedUp . "\";"
  . ":local id [/ip hotspot user find where name=\$uu];"
  . ":if ([:len \$id] = 0) do={ /system scheduler remove [find where name=\$su]; } else={"
  . "  :if ([/ip hotspot user get \$id disabled] = true) do={ /system scheduler remove [find where name=\$su]; /system scheduler remove [find where name=\$sc]; } else={"
  . "    :local up [/ip hotspot user get \$id uptime];"
  . "    :local days 0; :local rest \$up;"
  . "    :local pd [:find \$up \"d\"];"
  . "    :if (\$pd != nil) do={ :set days [:tonum [:pick \$up 0 \$pd]]; :set rest [:pick \$up (\$pd+2) [:len \$up]]; }"
  . "    :local h [:tonum [:pick \$rest 0 2]];"
  . "    :local m [:tonum [:pick \$rest 3 5]];"
  . "    :local s [:tonum [:pick \$rest 6 8]];"
  . "    :local sec ((\$days*86400)+(\$h*3600)+(\$m*60)+\$s);"
  . "    :if (\$sec >= 86400) do={"
  . "      /ip hotspot active remove [find where user=\$uu];"
  . "      /ip hotspot user set [find where name=\$uu] disabled=yes;"
  . "      :local c [/ip hotspot user get [find where name=\$uu] comment];"
  . "      :if ([:find \$c \"EXPIRED |\"] = nil) do={ /ip hotspot user set [find where name=\$uu] comment=(\"EXPIRED | \" . \$c); }"
  . "      /system scheduler remove [find where name=\$sc];"
  . "      /system scheduler remove [find where name=\$su];"
  . "    }"
  . "  }"
  . "}"
)

:delay 2s
:local expClock [/system scheduler get [find where name=$schedClock] next-run]
:local oldC [/ip hotspot user get $uid comment]
:if ([:find $oldC "EXPIRES(CLOCK):"] = nil) do={
    :if ([:len $oldC] = 0) do={
        /ip hotspot user set $uid comment=("EXPIRES(CLOCK): " . $expClock)
    } else={
        /ip hotspot user set $uid comment=($oldC . " | EXPIRES(CLOCK): " . $expClock)
    }
}

}}

Latest RouterOS versions show the error in the log with exact line and character, when a script fails. It should tell, where the problem occurs.

It could be, for example, that hotspots aren't allowed in device-mode,
or that you haven't paid your electricity bill.

You haven't even explained the error you're getting... (see also the previous post).

Boss, I need a script for 1-day profile that expires in the next 24hours after the first login.
I also want to lock the first user to that voucher.

okay

I will check