Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this Game Managing Script not Working?

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

1 comment

0

Change "script.Parent.Changed" to "script.Done.Changed"

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.