Why does the second "if" play if the Finished.Value is already true?
while true do wait()
if script.Parent.Finished.Value == true and script.Finished.Value == false and game.Workspace.Finished.First.Took.Value == false then script.Parent.Results.Visible = true script.Finished.Value = true game.Workspace.Finished.First.Took.Value = true game.Workspace.Finished.First.Value = "1 - "..game.Players.LocalPlayer.Name wait(1) if script.Parent.Finished.Value == true and script.Finished.Value == false and game.Workspace.Finished.Second.Took.Value == false then script.Parent.Results.Visible = true script.Finished.Value = true game.Workspace.Finished.Second.Took.Value = true game.Workspace.Finished.Second.Value = "2 - "..game.Players.LocalPlayer.Name end
end end
Could you explain what you're trying to do here? I'm confused.
You have the second if
statement nested within the first, and I can't see why.
By the way, ValueObjects have a Changed
event that only fires when the Value changes, so you don't have to put this code in an infinite loop.
Try putting:
elseif script.Parent.Finished.Value == true and script.Finished.Value == false and game.Workspace.Finished.Second.Took.Value == false then
for the start if the second 'if', so just change 'if' to 'elseif'
You need to be constantly checking for the value, so I recommend doing something like this:
repeat wait() until script.Parent.Finished.Value == true and script.Finished.Value == false
So basically, make it wait for that value to change in order to run the code below. Did this help?