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

Why is this Game Managing Script not Working?

Asked by 9 years ago

The script is supposed to do some minor things at the moment, just to see if it works or not. And in fact, it doesn't work, and I have no idea why. Everything is defined, and output couldn't be less helpful. Can someone please help me?

Here's the script:

function check_if_true()
if USMC.Value == SL.Value or PLA.Value == SL.Value or Up.Value == true then return true end
return false
end

script.Parent.Changed:connect(function ()
if check_if_true() then
print("No problem here.")
Redo()
end
end)

function Redo()
    if USMC.Value == PLA.Value then
        print("Tie.")
    elseif USMC.Value > PLA.Value then
        print("USMC.")
    elseif USMC < PLA.Value then
        print("PLA.")
    end
    print("New game is starting up, blah blah blah.")
    USMC.Value = 0
    PLA.Value = 0
end
0
Change "script.Parent.Changed" to "script.Done.Changed" CoolJohnnyboy 121 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

For one, you're trying to call the function Redo() before it's been defined in the script.

function check_if_true()
if USMC.Value == SL.Value or PLA.Value == SL.Value or Up.Value == true then return true end
return false
end

function Redo()
    if USMC.Value == PLA.Value then
        print("Tie.")
    elseif USMC.Value > PLA.Value then
        print("USMC.")
    elseif USMC < PLA.Value then
        print("PLA.")
    end
    print("New game is starting up, blah blah blah.")
    USMC.Value = 0
    PLA.Value = 0
end

script.Parent.Changed:connect(function ()
if check_if_true() then
print("No problem here.")
Redo()
end
end)

This may not be your only problem, but it's a start.

Ad

Answer this question