#Countdown and Winner/Fail isn't working

1 messages · Page 1 of 1 (latest)

steep escarp
#

I'm not that great at scripting, using someone else's script for my game, the game is basically a obby racing game, where you gotta complete the obby in a certain amount of time to win, but if the timer hits 0 then everyone lose and including failing the obby, the bit for the timer and win/fail part of the script isn't working well, the intermission and loading up the map works fine, I know where it's not working, but idk how to fix it myself

    t=360
    repeat
        t = t-1
        s.Value = t.." seconds left"
        wait (1)
        local ingame = workspace.Ingame:GetChildren()
    until t ==0 or vals.Winner.Value ~= "" or #ingame == 0
    if vals.Winner.Value ~= "" then
        s.Value = vals.Winner.Value.. " has won!"
        game.Players[vals.Winner.Value].leaderstats.Points.Value =game.Players[vals.Winner.Value].leaderstats.Coins.Value +5
        game.Players[vals.Winner.Value].leaderstats.Wins.Value = game.Players[vals.Winner.Value].leaderstats.Wins.Value +1
        vals.Winner.Value = ""
    else
        s.Value = "No one has won!"    
    end
civic pagoda
#

Sorry, but I can’t help you, because I want to sleep 🛌

#

Bye

steep escarp
#

I know a bit of it but not much, but it's difficult to learn since Lua scripting is pretty hard to fully master

covert cove
#

Thats alright, copying scripts is how we all start out, and besides not everyone wants to or enjoys scripting. Anyway, what do you mean by its not working well

#

is it just not displaying anything

#

Oh and btw on the like where it says wait(1) change it too task.wait(1) as wait is outdated and is not as accurate

steep escarp
#

and also earn Wins and coins

visual trench
covert cove
#

I recommend doing that too they are better and more common

#

Also are you sure your actually setting the vals.Winner.Value? You could put print statments in to verify whats running

steep escarp
#

I'll check it out when I have time and I'll try the loop script in it too