Dr01d3k4Join Date: 2007-10-11 Post Count: 17916 |
adminchose = game.Workspace.MinigameAdminChosen
gameplaying = game.Workspace.MinigamePlaying
checkfordeath = true
points = 0
platamnt = game.Workspace.PlatformAmount.Value
platleft = 25
removethisplat = 0
platwaittime = 0.15
check = 0
everybodylost = false
checkingpeoples = false
function givetool(tool)
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i].leaderstats.Round.Value == gameplaying.Value) then
local newtool = tool:Clone()
newtool.Parent = p[i].Backpack
else
print("p[i].leaderstats.Round.Value ~= gameplaying.Value!")
end
end
end
function teleto(x, y, z)
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i].leaderstats.Round.Value == 0) then
p[i].leaderstats.Round.Value = gameplaying.Value
local newx = x + math.random(-5,5)
local newy = y + 5
local newz = z + math.random(-5,5)
p[i].Character.Torso.CFrame = CFrame.new(Vector3.new(newx, newy, newz))
end
end
end
function rewardwinners(amnt)
local p = game.Players:GetChildren()
for i =1, #p do
if (p[i].leaderstats.Round.Value == gameplaying.Value) then
p[i].leaderstats.Points.Value = p[i].leaderstats.Points.Value + amnt
p[i].leaderstats.Played.Value = p[i].leaderstats.Played.Value + 1
showtwomsg("Message", "The round winners are: " ..p[i].Name.."", game.Workspace, 5, "Hint", "You have won " ..points.. " points!, Congratulations!", p[i])
end
end
end
function hidemsg(parent)
local p = parent:GetChildren()
for i = 1, #p do
if (p[i].className == "Message") or (p[i].className == "Hint") then
p[i]:remove()
end
end
end
function showmsg(type, text, parent, time)
hidemsg(parent)
local m = Instance.new(type)
m.Parent = parent
m.Text = text
wait(time)
hidemsg(parent)
end
function showtwomsg(type1, text1, parent1, time, type2, text2, parent2)
hidemsg(parent1)
hidemsg(parent2)
local m = Instance.new(type2)
m.Parent = parent2
m.Text = text2
local m = Instance.new(type1)
m.Parent = parent1
m.Text = text1
wait(time)
hidemsg(parent1)
hidemsg(parent2)
end
function findpoints()
points = 0
local p = game.Players:GetChildren()
for i =1, #p do
if (p[i].leaderstats.Round.Value == gameplaying.Value) then
points = points +1
print("Points is " ..points.. "")
points = math.random(points * 2, points * 3)
print("Points is " ..points.. "")
end
end
end
function resetpeople()
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i].leaderstats.Round.Value == gameplaying.Value) then
p[i].Character.Humanoid.Health = p[i].Character.Humanoid.Health -100
end
end
end
function everybodylosthaha()
if (everybodylost == true) then
check = 0
checkingpeoples = false
print("Everybody Lost!")
showmsg("Message", "Everybody lost!", game.Workspace, 5)
if (gameplaying.Value == 1) then
gameplaying.Value = 0
everybodylost = false
wait(5)
checkpeoples()
end
if (gameplaying.Value == 2) then
gameplaying.Value = 0
everybodylost = false
wait(5)
checkpeoples()
end
if (gameplaying.Value == 3) then
gameplaying.Value = 0
everybodylost = false
wait(5)
checkpeoples()
end
if (gameplaying.Value == 4) then
gameplaying.Value = 0
everybodylost = false
wait(5)
checkpeoples()
end
else
print("Everybodylost == false!")
end
end
function checkplayingpeoples(p)
if (checkingpeoples == true) then
checkingpeoples = true
local playpeoples = 0
check = check +1
print("Check is "..check.."")
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i]:findFirstChild("leaderstats") ~= nil) then
playpeoples = playpeoples +1
if (p[i].leaderstats.Round.Value < 1) then
playpeoples = playpeoples -1
print("Play Peoples is " ..playpeoples.. "")
if (playpeoples < 1) then
print("Everybody Lost!")
everybodylost = true
everybodylosthaha()
check = 60
else
print("Play Peoples is bigger then 0")
end
else
print("Play Peoples is " ..playpeoples.. "")
if (playpeoples < 1) then
print("Everybody Lost!")
everybodylost = true
everybodylosthaha()
check = 60
else
print("Play Peoples is bigger then 0")
end
end
end
end
else
if (check > 60) then
checkingpeoples = true
local playpeoples = 0
check = check +1
print("Check is "..check.."")
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i]:findFirstChild("leaderstats") ~= nil) then
playpeoples = playpeoples +1
if (p[i].leaderstats.Round.Value < 1) then
playpeoples = playpeoples -1
print("Play Peoples is " ..playpeoples.. "")
if (playpeoples < 1) then
print("Everybody Lost!")
everybodylost = true
everybodylosthaha()
check = 60
else
print("Play Peoples is bigger then 0")
if (check > 60) then
check = 0
end
end
else
print("Play Peoples is " ..playpeoples.. "")
if (playpeoples < 1) then
print("Everybody Lost!")
everybodylost = true
everybodylosthaha()
check = 60
else
print("Play Peoples is bigger then 0")
if (check > 60) then
check = 0
end
end
end
end
end
else
print("Either CheckingPeoples == false or check is bigger then 60")
end
end
end
function endgame3()
check = 0
checkingpeoples = false
showmsg("Message", "Game over!", game.Workspace,5)
wait(3)
showmsg("Message", "Winners recieve: " ..points.."", game.Workspace, 5)
rewardwinners(points)
resetpeople()
gameplaying.Value = 0
end
function repickplat()
pickplat()
end
function pickplat()
removethisplat = math.random(1, platamnt)
print(removethisplat)
local platname = "Platform"..removethisplat..""
print(platname)
local findplat = dissplatbackup2:findFirstChild(platname)
if (findplat ~= nil) then
local findval = findplat:findFirstChild("Value")
if (findval ~= nil) then
if (findval.Value == removethisplat) then
wait(5)
print(findval.Value)
removeobj(findplat)
end
else
print("Error at function pick plat!. Findval returns nil!")
print("The platform without the value is " ..plat[i].Name.."")
print("Oh Noez! This means that the world is becoming a lie! First cake, now FindVal!")
print("Lolz0r!")
end
else
print("Platform doesn't exist!")
removethisplat = math.random(1, platamnt)
print(removethisplat)
local platname = "Platform"..removethisplat..""
print(platname)
local findplat = dissplatbackup2:findFirstChild(platname)
if (findplat ~= nil) then
local findval = findplat:findFirstChild("Value")
if (findval ~= nil) then
if (findval.Value == removethisplat) then
wait(5)
print(findval.Value)
removeobj(findplat)
end
end
else
repickplat()
end
end
end
function removeobj(obj)
obj.Color = Color3.new(0,0,0)
wait(.5)
obj.Transparency = 0.1
wait(platwaittime)
obj.Transparency = 0.2
wait(platwaittime)
obj.Transparency = 0.3
wait(platwaittime)
obj.Transparency = 0.4
wait(platwaittime)
obj.Transparency = 0.5
wait(platwaittime)
obj.Transparency = 0.6
wait(platwaittime)
obj.Transparency = 0.7
wait(platwaittime)
obj.Transparency = 0.8
wait(platwaittime)
obj.Transparency = 0.9
wait(platwaittime)
obj.Transparency = 1
obj.CanCollide = false
platleft = platleft -1
checkingpeoples = true
repeat
wait(1)
checkplayingpeoples()
until (check == 1)
checkingpeoples = false
check = 0
if (platleft > 1) then
pickplat()
else
endgame3()
end
end
function game1()
game.Workspace.MinigameAdminChosen.Value = 0
findpoints()
local playpeoples = 0
gameplaying.Value = 1
wait(3)
showmsg("Message", "Minigame 1!", game.Workspace,5)
wait(3)
showmsg("Message", "Sword fight!", game.Workspace,5)
wait()
teleto(game.Workspace.SwordFight.Base.Position.x, game.Workspace.SwordFight.Base.Position.y, game.Workspace.SwordFight.Base.Position.z)
givetool(game.Workspace.LinkedSword)
checkingpeoples = true
repeat
wait(1)
checkplayingpeoples()
until (check == 60)
checkingpeoples = false
check = 0
if (gameplaying.Value == 1) then
showmsg("Message", "Game over!", game.Workspace,5)
wait(3)
showmsg("Message", "Winners recieve: " ..points.."", game.Workspace, 5)
rewardwinners(points)
resetpeople()
gameplaying.Value = 0
points = 0
end
end
function game2()
game.Workspace.MinigameAdminChosen.Value = 0
findpoints()
gameplaying.Value = 2
wait(3)
showmsg("Message", "Minigame 2!", game.Workspace,5)
wait(3)
showmsg("Message", "Tilting platform!", game.Workspace,5)
wait()
teleto(game.Workspace.TiltingPlatform.Position.x, game.Workspace.TiltingPlatform.Position.y, game.Workspace.TiltingPlatform.Position.z)
checkingpeoples = true
repeat
wait(1)
checkplayingpeoples()
until (check == 60)
checkingpeoples = false
check = 0
if (gameplaying.Value == 2) then
showmsg("Message", "Game over!", game.Workspace,5)
wait(3)
showmsg("Message", "Winners recieve: " ..points.."", game.Workspace, 5)
rewardwinners(points)
resetpeople()
gameplaying.Value = 0
end
end
function game3()
game.Workspace.MinigameAdminChosen.Value = 0
findpoints()
gameplaying.Value = 3
wait(3)
showmsg("Message", "Minigame 3!", game.Workspace,5)
wait(3)
showmsg("Message", "Dissepearing Platforms!", game.Workspace,5)
local plats = game.Workspace.Platforms:GetChildren()
for i = 1, # plats do
if (plats[i].className == "Part") then
plats[i].CanCollide = true
plats[i].Transparency = 0
wait(.01)
end
end
local p = game.Players:GetChildren()
for i = 1, #p do
if (p[i].leaderstats.Round.Value == 0) then
p[i].leaderstats.Round.Value = gameplaying.Value
local x = game.Workspace.Platforms.PlatformCenter.Position.x
local y = game.Workspace.Platforms.PlatformCenter.Position.y
local z = game.Workspace.Platforms.PlatformCenter.Position.z
local newx = x + math.random(-5,5)
local newy = y + 5
local newz = z + math.random(-5,5)
p[i].Character.Torso.CFrame = CFrame.new(Vector3.new(newx, newy, newz))
wait(.1)
end
end
pickplat()
end
function game4()
game.Workspace.MinigameAdminChosen.Value = 0
findpoints()
gameplaying.Value = 4
wait(3)
showmsg("Message", "Minigame 4!", game.Workspace,5)
wait(3)
showmsg("Message", "Jump the platforms!", game.Workspace,5)
wait()
teleto(game.Workspace.Jump.Start.Position.x, game.Workspace.Jump.Start.Position.y, game.Workspace.Jump.Start.Position.z)
checkingpeoples = true
repeat
wait(1)
checkplayingpeoples()
until (check == 60)
checkingpeoples = false
check = 0
if (gameplaying.Value == 4) then
showmsg("Message", "Game over!", game.Workspace,5)
wait(3)
showmsg("Message", "Winners recieve: " ..points.."", game.Workspace, 5)
rewardwinners(points)
resetpeople()
gameplaying.Value = 0
end
end
function findadmingame()
if (adminchose.Value == 1) then
game1()
end
if (adminchose.Value == 2) then
game2()
end
--if (adminchose.Value == 3) then
--game3()
--end
if (adminchose.Value == 4) then
game4()
end
if (adminchose.Value == 3) then
adminchose.Value = 0
pickgame()
end
end
function pickgame()
if (game.Workspace.MinigameAdminChosen.Value ~= 0) then
findadmingame()
else
local minigame = math.random(1,4)
if (minigame == 1) then
game1()
end
if (minigame == 2) then
game2()
end
--if (minigame == 3) then
--game3()
--end
if (minigame == 4) then
game4()
end
if (minigame == 3) then
pickgame()
end
end
end
function checkpeoples()
if (game.Workspace.Players.Value > 1) or (game.Workspace.AutoPlay.Value == 1) then
showmsg("Message", "Minigames started!", game.Workspace,5)
wait(3)
pickgame()
elseif (game.Players.NumPlayers > 1) then
showmsg("Message", "Minigames started!", game.Workspace,5)
wait(3)
pickgame()
else
wait(5)
showmsg("Message", "You need one more player to play the minigames", game.Workspace, 5)
beep()
end
end
function beep()
everybodylost = false
checkpeoples()
end
while true do
wait(5)
beep()
end |