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

Why does my script stop at 'if' and does not move on?

Asked by 10 years ago

This is basically what constitutes f. :

for k, f in pairs(Game.Players:GetPlayers()) do coroutine.wrap(function() 

Now this is the PORTION where the trouble begins and where the script doesn't move on:

GameState = Instance.new("IntValue")
GameState.Parent = f.Backpack
GameState.Name = "GameState"
f.Backpack.GameState.Value = 1

if f.Backpack.GameState.Value == 1 then <----Line 108: It does a check, but if I do not have IntValue GameState in my backpack, the script does not continue.
Game.Lighting.BeginnerSword:Clone().Parent = f.Backpack wait(0.1)
f.Backpack.GameState:Destroy()
end
H = Instance.new("Hint")
H.Parent = game.Workspace
time = 122
Game_Launch_Part_Three()
end)()
t = t + 1 if t > #spawns then t = 1 
end
end
wait(.1)
end

This is basically what happens in a nutshell: To test this script, I go in-game and then I wait a bit for the script to place GameState in my backpack(and it does all of that fine) then I reset to test if the script keeps moving even if the player(s) do not have GameState in their backpack but it doesn't and it stops and gives these errors:

19:36:14.440 - GameState is not a valid member of Backpack
19:36:14.441 - Script 'Workspace.OvEngine(Game Script)', Line 108
19:36:14.442 - Stack End

I want it to continue even if I reset and do not have GameState in my backpack. It does not do that, it stops at 'if' and returns the following error. You do not need the whole script, I checked the whole script and it is working fine up to the 'if' part. That portion is the only portion that needs fixing.

Answer this question