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

Why is this Game Script not Working?

Asked by 9 years ago

So this script is supposed to reset and restart a game.

It doesn't do any of that, and I don't know why.

Here's the script:

local Timer = game.Workspace.Count
local Play = game.Workspace.Playing
local Score1 = game.Workspace.TOScore
local Score2 = game.Workspace.TTScore
local msg = Instance.new("Message")

while true do
    if Score1.Value == 2 or Score2.Value == 2 or Timer.Value == 0 then
        Play.Value = false
        Score1.Value = 0
        Score2.Value = 0
        Timer.Value = 20
    end
    if Score1.Value > Score2.Value then
    msg.Parent = game.Workspace
    msg.Text = "Blue has won the battle!"
    wait(4)
    msg:remove()
    elseif Score1 < Score2 then
    msg.Parent = game.Workspace
    msg.Text = "Red has won the battle!"
    wait(4)
    msg:remove()
    else if Score1 == Score2 then
    msg.Parent = game.Workspace
    msg.Text = "It was a tie!"
    wait(4)
    msg:remove()
    end
    Play.Value = true
    end
end

1 answer

Log in to vote
0
Answered by 9 years ago

I believe the error is on this line:

else if Score1 == Score2 then

You should change it to this:

elseif Score1 == Score2 then
0
Thanks. I would try it out, but I recently found an alternative that has everything I need in it already. Thank you very much, I will probably use this for other things in the future. CoolJohnnyboy 121 — 9y
Ad

Answer this question