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

Why is the script constantly repeating itself on different parts of the code?

Asked by
3dsonicdx 163
9 years ago
GameMessage = game.Workspace.globalDisplay.GUIs.GameMessage.Frame.Message
TeemoShroomCooldown = 25
PointsService = game:GetService("PointsService")

wait(0.1)
for i = 1,25 do
print(""..TeemoShroomCooldown.." shrooms have been planted.")
GameMessage.Text = ""..TeemoShroomCooldown.." - Intermission"
_G.Display("GameMessage", 1)
TeemoShroomCooldown = TeemoShroomCooldown - 1
end
wait(0.1)
GameMessage.Text = "Welcome to 3dsonicdx's Identity Thief!"
_G.Display("GameMessage", 2.5)
GameMessage.Text = "First we need to check if there are two players in the server or more.."
_G.Display("GameMessage", 2.5)
shrooms = game.Players:GetChildren()
if #shrooms>=2 then

wait(0.1)
print(""..math.random(1,750000).." currently are out to hunt Teemo.")

GameMessage.Text = "So, let's get our game started!"
_G.Display("GameMessage", 2.5)
-----
local junglecreeps = game.Players:GetChildren()

local Teemo = junglecreeps[math.random(1, #junglecreeps)]
wait(0.01)
CaptainTeemoOnDuty = Instance.new("ObjectValue")
CaptainTeemoOnDuty.Name = "Teemo"
CaptainTeemoOnDuty.Parent = Teemo.Character
wait(0.1)
Swiftly = Teemo.Name
wait(0.1)
shrooms = game.Players:GetChildren()
for i=1,#shrooms do
YesSir = Instance.new("ObjectValue")
YesSir.Name = "SurvivorsOfTeemo"
YesSir.Parent = shrooms[i].Character
wait(0.1)
if shrooms[i].Character:findFirstChild("Teemo") and shrooms[i].Character:findFirstChild("SurvivorsOfTeemo") then
shrooms[i].Character.SurvivorsOfTeemo:remove()
wait(0.1)
end
end
wait(0.1)
GameMessage.Text = "All the game variables have been set up. The game has started!"
_G.Display("GameMessage", 4)
game.Workspace.TeemoData.PlayingTeemo.Value = true
local spns=workspace:findFirstChild"Spawns":GetChildren()
plrs=game.Players:GetChildren()
for i=1,#plrs do
SizeDoesntmeananything = Instance.new("StringValue")
SizeDoesntmeananything.Name = "Identity"
SizeDoesntmeananything.Value = plrs[i].Name
SizeDoesntmeananything.Parent = plrs[i].Character
BlindingDart = game.ReplicatedStorage.Playing:clone()
BlindingDart.Parent = plrs[i].Character
plrs[i].Character.Torso.CFrame=spns[math.random(1,#spns)].CFrame
end
local LoL=game.Players:GetChildren()
for i=1,#LoL do
if LoL[i].Character:findFirstChild("Teemo") then
game.ReplicatedStorage:findFirstChild("ChooseClassThief"):Clone().Parent = LoL[i].PlayerGui
end
wait(1)
LoD = game.Players:GetChildren()
for i=1,#LoD do
if LoD[i].Character:findFirstChild("SurvivorsOfTeemo") then
game.ReplicatedStorage.PlayerKillCheck:clone().Parent = LoD[i].Character
game.ReplicatedStorage:findFirstChild("ChooseClass"):Clone().Parent = LoD[i].PlayerGui
end
wait(10)
for i, v in pairs (game.ReplicatedStorage.Neutral.FortifiedTown:GetChildren()) do 
v2 = v:Clone() 
v2.Parent = game.Workspace
v2:MakeJoints() 
end 
GameMessage.Text = "The timer has started and NPCs have spawned. Good luck!"
_G.Display("GameMessage", 5)
game.Workspace.TeemoData.TeemoTime.Value = 300
game.Workspace.TeemoData.TeemoLives.Value = 3
timecheck = game.Workspace.globalDisplay.GUIs.GameMessage.Frame.Message
worldendbutnotbyteemo = game.Players:GetChildren()
wait(0.1)
repeat 
wait(1) 
game.Workspace.TeemoData.TeemoTime.Value = game.Workspace.TeemoData.TeemoTime.Value - 1
if game.Workspace.TeemoData.PlayingTeemo.Value == false then break end
until game.Workspace.TeemoData.TeemoTime.Value == 0 or not worldendbutnotbyteemo[i].Character:FindFirstChild("Teemo")  --[[game.Workspace[(Swiftly)].Humanoid.Health <= 0 --]]or not worldendbutnotbyteemo[i].Character:FindFirstChild("SurvivorsOfTeemo") 
game.Workspace.TeemoData.PlayingTeemo.Value = false
if game.Workspace.TeemoData.TeemoTime.Value == 0 or worldendbutnotbyteemo[i].Character:FindFirstChild("Teemo") == nil then
print("Player Success.")
wait(0.1)
for i, v in pairs (game.Workspace:GetChildren()) do 
if v:findFirstChild("UnitStatus") then
v:Destroy()
end
end
GameMessage.Text = "There are still players on the map, so "..Swiftly.." has been defeated!"
_G.Display("GameMessage", 5)
if shrooms[i].Character:findFirstChild("SurvivorsOfTeemo") then
shrooms[i].TeemoMid.PlayerVictories.Value = shrooms[i].TeemoMid.PlayerVictories.Value + 1
shrooms[i].TeemoMid.TeemoPoints.Value = shrooms[i].TeemoMid.TeemoPoints.Value + 5
wait(0.1)
game:GetService("PointsService"):AwardPoints(shrooms[i].userId,1)
GameMessage.Text = "All players alive have recieved 5 Teemo Points for their victory!"
_G.Display("GameMessage", 5)
worldendbutnotbyteemo[i].Character.Humanoid.Health = 0
end
wait(0.1)
script.Disabled = true
wait(1)
elseif worldendbutnotbyteemo[i].Character:FindFirstChild("SurvivorsOfTeemo") == nil then
wait(0.1)
for i, v in pairs (game.Workspace:GetChildren()) do 
if v:findFirstChild("UnitStatus") then
v:Destroy()
end
end
print("Teemo success.")
GameMessage.Text = "All players have been wiped off the map, congratulations to "..Swiftly.." for killing everyone off!"
_G.Display("GameMessage", 5)
if shrooms[i]:findFirstChild("Teemo") then
shrooms[i].TeemoMid.TeemoVictories.Value = shrooms[i].TeemoMid.TeemoVictories.Value + 1
shrooms[i].TeemoMid.TeemoPoints.Value = shrooms[i].TeemoMid.TeemoPoints.Value + 10
wait(0.1)
GameMessage.Text = ""..Swiftly.." has recieved 10 Teemo Points for their victory!"
_G.Display("GameMessage", 5)
game:GetService("PointsService"):AwardPoints(shrooms[i].userId,1)
worldendbutnotbyteemo[i].Character.Humanoid.Health = 0
end
wait(0.1)
script.Disabled = true
wait(1)
else
wait(0.1)
print("Code: "..math.random(1,1000)..". Activating countermeasure.")
GameMessage.Text = "Someone has breached Teemo's authority, and we're fixing the game immediately."
_G.Display("GameMessage", 5)
for i, v in pairs (game.Workspace:GetChildren()) do 
if v:findFirstChild("UnitStatus") then
v:Destroy()
end
end
worldendbutnotbyteemo[i].Character.Humanoid.Health = 0
wait(0.1)
script.Disabled = true
wait(1)
end
end
end
else
wait(0.1)
GameMessage.Text = "This requires two players or more. Restarting the Intermission.."
_G.Display("GameMessage", 5)
wait(0.1)
script.Destroy()
-------------------------------
end

So far I have no clue why the script repeats itself constantly even when it's disabled. What happens is it restarts at a certain point in the script, specifically it restarts around "GameMessage.Text = "The timer has started and NPCs have spawned. Good luck!" Even when the script is disabled, and if I re-enable it as well, it's like they're running two different sections of the code at the same time.

GameMessage connects to a global function which spawns a GUI for a certain amount of seconds.

Also, I put teemo a lot. Teemo #1.

Answer this question