Mateusz667

Untitled

Apr 3rd, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. activatedist = 3
  2.  
  3. local lop = game:GetService("InsertService")
  4. local hi = lop:LoadAsset(42613502)
  5. local sw = hi:GetChildren()[1]
  6.  
  7. rc = {"Earth green", "Brown", "Dark green", "Camo"}
  8. types = 1
  9.  
  10. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  11. part.Parent = parent
  12. part.formFactor = form
  13. part.CanCollide = collide
  14. part.Transparency = tran
  15. part.Reflectance = ref
  16. part.Size = Vector3.new(x,y,z)
  17. part.BrickColor = BrickColor.new(color)
  18. part.TopSurface = 0
  19. part.BottomSurface = 0
  20. part.Anchored = anchor
  21. part.Locked = true
  22. part:BreakJoints()
  23. end
  24.  
  25. function generate()
  26. local siz = math.random(180,300)
  27. local pos = Vector3.new(math.random(-2600,2600),math.random(200,3000),math.random(-2600,2600))
  28. local mod = Instance.new("Model",workspace)
  29. mod.Name = "Terrain"
  30. local b = Instance.new("Part")
  31. prop(b,mod,true,0,0,siz,3,siz,rc[math.random(1,#rc)],true,"Custom")
  32. b.CFrame = CFrame.new(pos)
  33. local b2 = Instance.new("Part")
  34. prop(b2,mod,true,0,0,siz,3,siz,rc[math.random(1,#rc)],true,"Custom")
  35. b2.CFrame = CFrame.new(pos) * CFrame.new(0,80,0)
  36. local hi = math.random(1,types)
  37. if hi == 1 then
  38. for o=7,80,siz/14 do
  39. for i=1,360,11 do
  40. local p = Instance.new("Part",mod)
  41. prop(p,mod,true,0,0,siz/7,siz/7,siz/7,rc[math.random(1,#rc)],true,"Custom")
  42. p.CFrame = CFrame.new(pos) * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,o,-siz/2.1) * CFrame.Angles(math.random(-32,32),math.random(-32,32),math.random(-32,32))
  43. end
  44. end
  45. end
  46. return pos, mod
  47. end
  48.  
  49. function gui(p1,p2)
  50. local sc = Instance.new("ScreenGui",p1.PlayerGui)
  51. sc.Name = "Fight"
  52. local fr = Instance.new("Frame",sc)
  53. fr.Position = UDim2.new(0.35,0,0.4,0)
  54. fr.Size = UDim2.new(0.3,0,0.12,0)
  55. fr.BackgroundColor3 = Color3.new(0.4,0.0,0.05)
  56. local fi = Instance.new("TextButton",fr)
  57. fi.Size = UDim2.new(0.8,0,0.25,0)
  58. fi.Position = UDim2.new(0.1,0,0.1,0)
  59. fi.Text = "Fight "..p2.Name
  60. fi.MouseButton1Click:connect(function()
  61. sc:remove()
  62. local lo = p2.PlayerGui:findFirstChild("Fight")
  63. if lo ~= nil then lo:remove() end
  64. local ta = {p1,p2}
  65. local na = {sw:clone(),sw:clone()}
  66. local orig1, orig2 = ta[1].Character.Torso.Position, ta[2].Character.Torso.Position
  67. local win = nil
  68. local los = nil
  69. local able = true
  70. local map, modul = generate()
  71. for i,v in pairs(ta) do
  72. v.Character.Humanoid.Died:connect(function()
  73. if win == nil and los == nil and able then
  74. if i == 1 then
  75. los = v
  76. win = ta[2]
  77. elseif i == 2 then
  78. los = v
  79. win = ta[1]
  80. end
  81. local heh = Instance.new("TextLabel",win.PlayerGui.Fade)
  82. heh.Size = UDim2.new(1,1,1,1)
  83. heh.Position = UDim2.new(0,0,0,-1)
  84. heh.BackgroundColor3 = Color3.new(0,0,0)
  85. heh.TextColor3 = Color3.new(1,1,1)
  86. heh.TextTransparency = 1
  87. heh.BackgroundTransparency = 1
  88. heh.Text = "You pwned "..los.Name.."!!!!!!!!!!!!!!"
  89. local hah = Instance.new("TextLabel",los.PlayerGui.Fade)
  90. hah.Size = UDim2.new(1,1,1,1)
  91. hah.Position = UDim2.new(0,0,0,-1)
  92. hah.BackgroundColor3 = Color3.new(0,0,0)
  93. hah.TextColor3 = Color3.new(1,1,1)
  94. hah.TextTransparency = 1
  95. hah.BackgroundTransparency = 1
  96. hah.Text = "You lost!"
  97. for _,v in pairs(na) do
  98. v:remove()
  99. end
  100. able = false
  101. coroutine.resume(coroutine.create(function()
  102. for i=1.2, -0.2, -0.02 do
  103. wait()
  104. heh.TextTransparency = i
  105. heh.BackgroundTransparency = i
  106. hah.TextTransparency = i
  107. hah.BackgroundTransparency = i
  108. end
  109. if i == 1 then
  110. ta[2].Character:MoveTo(orig2)
  111. else
  112. ta[1].Character:MoveTo(orig1)
  113. end
  114. modul:remove()
  115. wait(1.5)
  116. for i=-0.2, 1.2, 0.02 do
  117. wait()
  118. heh.TextTransparency = i
  119. heh.BackgroundTransparency = i
  120. end
  121. pcall(function()
  122. los.PlayerGui.Fade:remove()
  123. win.PlayerGui.Fade:remove()
  124. end)
  125. end))
  126. end
  127. end)
  128. end
  129. for i,v in pairs(ta) do
  130. v.Character.Humanoid.WalkSpeed = 0
  131. local s = Instance.new("ScreenGui",v.PlayerGui)
  132. s.Name = "Fade"
  133. local heh = Instance.new("TextLabel",s)
  134. heh.Size = UDim2.new(1,1,1,1)
  135. heh.Position = UDim2.new(0,0,0,-1)
  136. heh.BackgroundColor3 = Color3.new(0,0,0)
  137. heh.TextColor3 = Color3.new(1,1,1)
  138. heh.TextTransparency = 1
  139. heh.BackgroundTransparency = 1
  140. heh.Text = "The battle is about to begin....."
  141. coroutine.resume(coroutine.create(function()
  142. for i=1.2, -0.2, -0.02 do
  143. wait()
  144. heh.TextTransparency = i
  145. heh.BackgroundTransparency = i
  146. end
  147. v.Character:MoveTo(map + Vector3.new(math.random(-40,40),6,math.random(-40,40)))
  148. pcall(function()
  149. na[i].Parent = v.Backpack
  150. end)
  151. wait(2)
  152. for i=-0.2, 1.2, 0.02 do
  153. wait()
  154. heh.TextTransparency = i
  155. heh.BackgroundTransparency = i
  156. end
  157. heh:remove()
  158. v.Character.Humanoid.WalkSpeed = 16
  159. end))
  160. end
  161. end)
  162. local de = Instance.new("TextButton",fr)
  163. de.Size = UDim2.new(0.8,0,0.25,0)
  164. de.Position = UDim2.new(0.1,0,0.4,0)
  165. de.Text = "Decline"
  166. de.MouseButton1Click:connect(function()
  167. sc:remove()
  168. local lo = p2.PlayerGui:findFirstChild("Fight")
  169. if lo ~= nil then lo:remove() end
  170. end)
  171. end
  172.  
  173. function givegui(p1,p2)
  174. local pg1, pg2 = p1:findFirstChild("PlayerGui"), p2:findFirstChild("PlayerGui")
  175. if pg1 ~= nil and pg2 ~= nil then
  176. gui(p1,p2)
  177. gui(p2,p1)
  178. end
  179. end
  180.  
  181. function find(pos,plr)
  182. local to = nil
  183. local dist = activatedist
  184. local temp = nil
  185. local temp2 = nil
  186. for _,v in pairs(game.Players:GetPlayers()) do
  187. if v.Character and v:findFirstChild("PlayerGui") and v ~= plr then
  188. if v.PlayerGui:findFirstChild("Fight") == nil and v.PlayerGui:findFirstChild("Fade") == nil then
  189. temp = v.Character:findFirstChild("Torso")
  190. temp2 = v.Character:findFirstChild("Humanoid")
  191. if temp ~= nil and temp2 ~= nil then
  192. if (temp.Position - pos).magnitude < dist then
  193. dist = (temp.Position - pos).magnitude
  194. to = v
  195. end
  196. end
  197. end
  198. end
  199. end
  200. return to
  201. end
  202.  
  203. while true do
  204. wait(0.3)
  205. for _,v in pairs(game.Players:GetPlayers()) do
  206. if v.Character then
  207. if v.Character:findFirstChild("Torso") then
  208. local p = find(v.Character.Torso.Position, v)
  209. if p ~= nil then
  210. givegui(v, p)
  211. end
  212. end
  213. end
  214. end
  215. end
Add Comment
Please, Sign In to add comment