Advertisement
Upscalefanatic34

Board game

May 22nd, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.82 KB | None | 0 0
  1. for _,v in pairs(game.Players:GetPlayers()) do
  2. for _,k in pairs(v:children()) do
  3. if k.Name == "teamva" or k.Name == "Gaah" or k.Name == "Trawps" or k.Name == "Attwk" or k.Name == "mainbas" or k.Name == "Barras" or k.Name == "barrack" or k.Name == "bank" or k.Name == "prods" or k.Name == "evrytin" then
  4. k:remove()
  5. end
  6. end
  7. end
  8. wait(0.5)
  9. terraincolors = {"Camo", "Earth green", "Earth green", "Earth green"}
  10. bombcolors = {"Bright red", "Bright yellow", "Neon orange"}
  11. basecf = CFrame.new(workspace.Base.Position)
  12. mainpos = Vector3.new(-60,0.5,-150)
  13. lolpos = CFrame.new(mainpos)
  14. lolok = basecf * lolpos * CFrame.new(0,1,0)
  15. name = "xSoul's board game"
  16. teamcolors = {"Bright violet", "Bright blue", "Bright red", "Bright yellow"}
  17. me = game.Players.Upscalegaming
  18. players = 4
  19. if game.Players.NumPlayers < players then
  20. repeat
  21. players = players - 1
  22. until players < game.Players.NumPlayers+1
  23. elseif players > 4 and game.Players.NumPlayers > 3 then
  24. players = 4
  25. end
  26. people = {me}
  27. mplrs = (players - #people)
  28. prodcost = 60
  29. barcost = 200
  30. soldcost = 40
  31. bankcost = 750
  32. factorycost = 2000
  33. towerdist = 6
  34. towerdmg = 8
  35. towercost = 285
  36. soldmg = 15
  37. bombdist = 6
  38. bombd = 80
  39. bombcost = 1000
  40. stealamount = 170
  41. interest = 120
  42. prodgive = 4
  43. eachbarrack = 3
  44. startermoney = 3000
  45. function addcol(plyr,val)
  46. local bv = Instance.new("StringValue")
  47. bv.Value = val
  48. bv.Name = "teamva"
  49. bv.Parent = plyr
  50. local go = Instance.new("IntValue",plyr)
  51. go.Name = "Gaah"
  52. go.Value = startermoney
  53. local tr = Instance.new("IntValue",plyr)
  54. tr.Name = "Trawps"
  55. tr.Value = 0
  56. local trf = Instance.new("BoolValue",plyr)
  57. trf.Name = "Attwk"
  58. trf.Value = false
  59. local ob = Instance.new("ObjectValue",plyr)
  60. ob.Name = "mainbas"
  61. local ob = Instance.new("ObjectValue",plyr)
  62. ob.Name = "barrack"
  63. local tr = Instance.new("IntValue",plyr)
  64. tr.Name = "Barras"
  65. tr.Value = 0
  66. pr = Instance.new("IntValue",plyr)
  67. pr.Name = "prods"
  68. pr.Value = 0
  69. local t = Instance.new("IntValue",plyr)
  70. t.Name = "bank"
  71. t.Value = 0
  72. local t = Instance.new("BoolValue",plyr)
  73. t.Name = "evrytin"
  74. t.Value = false
  75. go.Changed:connect(function(prop)
  76. if go.Value < 0 then
  77. go.Value = 0
  78. if tr.Value > 0 then
  79. tr.Value = tr.Value - 1
  80. end
  81. end
  82. end)
  83. end
  84. numba = 1
  85. for _,v in pairs(people) do
  86. addcol(v,teamcolors[numba])
  87. numba = numba + 1
  88. end
  89. function getplrs()
  90. if game:service("Players").NumPlayers > mplrs then
  91. local plrs = game:service("Players"):GetPlayers()
  92. local plr = plrs[math.random(1,#plrs)]
  93. local num = 0
  94. for _,k in pairs(people) do
  95. if plr.Name == k.Name then
  96. num = num + 1
  97. end
  98. end
  99. if num == 0 then
  100. numba = numba + 1
  101. addcol(plr,teamcolors[numba])
  102. table.insert(people,plr)
  103. else
  104. getplrs()
  105. end
  106. end
  107. end
  108. for i=1,mplrs do
  109. getplrs()
  110. end
  111. function getlols(path,pos,ply)
  112. local obj = nil
  113. local hel = nil
  114. local dist = towerdist
  115. for _,v in pairs(path:children()) do
  116. if v:findFirstChild("Health") ~= nil and v.Name == "Tile" then
  117. if v.Owner.Value ~= ply.Name and v.Type.Value ~= "Tower" and v.Type.Value ~= "Main base" then
  118. if (v.Position - pos).magnitude < dist then
  119. obj = v
  120. end
  121. end
  122. elseif v:findFirstChild("Amount") ~= nil and v.Name == "Unit" then
  123. if v.Ownah.Value ~= ply.Name then
  124. if (v.Position - pos).magnitude < dist then
  125. obj = v
  126. end
  127. end
  128. end
  129. end
  130. return obj,dist
  131. end
  132.  
  133. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  134. part.Parent = parent
  135. part.formFactor = form
  136. part.CanCollide = collide
  137. part.Transparency = tran
  138. part.Reflectance = ref
  139. part.Size = Vector3.new(x,y,z)
  140. part.BrickColor = BrickColor.new(color)
  141. part.TopSurface = 0
  142. part.BottomSurface = 0
  143. part.Anchored = anchor
  144. part.Locked = true
  145. part:BreakJoints()
  146. end
  147.  
  148. local lol = workspace:findFirstChild(name)
  149. if lol ~= nil then
  150. lol:remove()
  151. end
  152.  
  153. model = Instance.new("Model",workspace)
  154. model.Name = name
  155.  
  156. function buildingprops(plyr,modu,pa,helth,ty)
  157. local owner = Instance.new("StringValue",modu)
  158. owner.Value = plyr.Name
  159. owner.Name = "Owner"
  160. local poo = owner:clone()
  161. poo.Parent = pa
  162. local hp = Instance.new("IntValue",pa)
  163. hp.Name = "Health"
  164. hp.Value = helth
  165. local mod = Instance.new("StringValue",pa)
  166. mod.Value = ty
  167. mod.Name = "Type"
  168. end
  169.  
  170. function ruin(part)
  171. local mo = Instance.new("Model",part)
  172. mo.Name = "Barracks"
  173. local main = Instance.new("Part")
  174. prop(main,mo,true,0,0,1.6,0.4,0.6,"Reddish brown",true,"Custom")
  175. main.CFrame = part.CFrame * CFrame.new(0,(part.Size.Y/2)+(main.Size.Y/2),-1.3)
  176. for i = 1, math.random(4,12) do
  177. local pile = main:clone()
  178. pile.Parent = mo
  179. pile.CFrame = part.CFrame * CFrame.Angles(math.random(-30,30)/100,math.random(-32,32)/10,math.random(-30,30)/100) * CFrame.new(math.random(-10,10)/10,(part.Size.Y/2)+(main.Size.Y/2),math.random(-10,10)/10)
  180. end
  181. end
  182.  
  183. function showhp(show,part,playa)
  184. local hp = part.Health.Value
  185. local moneh = Instance.new("BillboardGui",part)
  186. moneh.Adornee = show
  187. moneh.Size = UDim2.new(0,20,0,20)
  188. local money = Instance.new("TextLabel",moneh)
  189. money.Size = moneh.Size
  190. money.Position = UDim2.new(0,0,0,-60)
  191. money.BackgroundTransparency = 1
  192. money.FontSize = "Size12"
  193. money.TextColor = BrickColor.new(playa.teamva.Value)
  194. money.Text = "HP: "..hp
  195. local chang = true
  196. function changa(prop)
  197. if chang then
  198. money.Text = "HP: "..part.Health.Value
  199. if part.Health.Value < 1 then
  200. chang = false
  201. part.Health.Value = 0
  202. Instance.new("Fire",part).Heat = 25
  203. if part.Type.Value == "Barracks" then
  204. local temp = game.Players:findFirstChild(part.Owner.Value)
  205. if temp ~= nil then
  206. temp.Barras.Value = temp.Barras.Value - 1
  207. end
  208. temp.barrack.Value = temp.mainbas.Value
  209. elseif part.Type.Value == "Producer" then
  210. local temp = game.Players:findFirstChild(part.Owner.Value)
  211. if temp ~= nil then
  212. temp.prods.Value = temp.prods.Value - 1
  213. end
  214. elseif part.Type.Value == "Main base" then
  215. for _,v in pairs(model:children()) do
  216. local own, helth = v:findFirstChild("Owner"), v:findFirstChild("Health")
  217. if own ~= nil and helth ~= nil then
  218. if own.Value == part.Owner.Value then
  219. helth.Value = 0
  220. local plag = game.Players:findFirstChild(own.Value)
  221. if plag ~= nil then
  222. plag.Gaah.Value = 0
  223. end
  224. end
  225. end
  226. end
  227. end
  228. wait(2)
  229. for _,v in pairs(part:children()) do v:remove() end
  230. ruin(part)
  231. end
  232. end
  233. end
  234. coroutine.resume(coroutine.create(function()
  235. while part.Health.Value > 0 do
  236. wait(3)
  237. if part.Health.Value < hp then
  238. part.Health.Value = part.Health.Value + 1
  239. end
  240. end
  241. end))
  242. money.Text = "HP: "..part.Health.Value
  243. part.Health.Changed:connect(changa)
  244. end
  245.  
  246. function giveresources(plyr,gold,part)
  247. local bill = Instance.new("BillboardGui",part)
  248. bill.Size = UDim2.new(0,10,0,10)
  249. bill.Adornee = part
  250. local tx = Instance.new("TextLabel",bill)
  251. tx.Size = bill.Size
  252. tx.Position = UDim2.new(0,0,0,-70)
  253. tx.BackgroundTransparency = 1
  254. tx.FontSize = "Size14"
  255. tx.TextColor = BrickColor.new("New yeller")
  256. if gold < 0 then
  257. tx.Text = gold
  258. tx.TextColor = BrickColor.new("Really red")
  259. elseif gold > 0 then
  260. tx.Text = "+"..gold
  261. tx.TextColor = BrickColor.new("Lime green")
  262. elseif gold == 0 then
  263. tx.Parent = nil
  264. end
  265. plyr.Gaah.Value = plyr.Gaah.Value + gold
  266. coroutine.resume(coroutine.create(function()
  267. for i = -70, math.random(-210,-150), -15 do
  268. wait()
  269. tx.Position = UDim2.new(0,0,0,i)
  270. end
  271. wait(0.4)
  272. tx:remove()
  273. end))
  274. end
  275.  
  276. function mainbase(part,playa)
  277. local mo = Instance.new("Model",part)
  278. mo.Name = "MainBase"
  279. buildingprops(playa,mo,part,6000,"Main base")
  280. local main = Instance.new("Part")
  281. prop(main,mo,false,0,0,2.3,1,1.2,"Reddish brown",true,"Custom")
  282. main.CFrame = part.CFrame * CFrame.new(0.4,(part.Size.Y/2)+(main.Size.Y/2),1.1)
  283. showhp(main,part,playa)
  284. playa.mainbas.Value = main
  285. local moneh = Instance.new("BillboardGui",main)
  286. moneh.Size = UDim2.new(0,600,0,100)
  287. moneh.Adornee = moneh.Parent
  288. local money = Instance.new("TextLabel",moneh)
  289. money.TextWrap = true
  290. money.Size = moneh.Size
  291. money.Position = UDim2.new(0,0,0,-100)
  292. money.BackgroundTransparency = 1
  293. money.FontSize = "Size12"
  294. money.TextColor = BrickColor.new(playa.teamva.Value)
  295. function changa(prop)
  296. money.Text = playa.Name..string.char(10)..[[
  297. Gold: ]]..playa.Gaah.Value..string.char(10)..[[
  298. Troops: ]]..playa.Trawps.Value
  299. if part.Health.Value < 1 then
  300. part.Health.Value = 0
  301. Instance.new("Fire",part).Heat = 25
  302. end
  303. end
  304. money.Text = playa.Name..string.char(10)..[[
  305. Gold: ]]..playa.Gaah.Value..string.char(10)..[[
  306. Troops: ]]..playa.Trawps.Value
  307. playa.Gaah.Changed:connect(changa)
  308. playa.Trawps.Changed:connect(changa)
  309. part.Health.Changed:connect(changa)
  310. local sec = Instance.new("Part")
  311. prop(sec,mo,false,0,0,1,1,2.5,"Reddish brown",true,"Custom")
  312. sec.CFrame = main.CFrame * CFrame.new(1.15,0,-0.6)
  313. for i=0,2,0.5 do
  314. local pile = Instance.new("Part")
  315. prop(pile,mo,false,0,0,0.35,0.7,0.35,playa.teamva.Value,true,"Custom")
  316. pile.CFrame = main.CFrame * CFrame.new(-i,-0.3,-0.85)
  317. end
  318. coroutine.resume(coroutine.create(function()
  319. while part.Health.Value > 0 do
  320. wait(math.random(940,1040)/100)
  321. giveresources(playa,10+(prodgive*playa.prods.Value),main)
  322. end
  323. end))
  324. coroutine.resume(coroutine.create(function()
  325. while part.Health.Value > 0 do
  326. wait(math.random(1700,1800)/100)
  327. giveresources(playa,-playa.Trawps.Value*2,main)
  328. end
  329. end))
  330. end
  331.  
  332. function producer(part,playa)
  333. local mo = Instance.new("Model",part)
  334. mo.Name = "Produce"
  335. buildingprops(playa,mo,part,90,"Producer")
  336. local main = Instance.new("Part")
  337. prop(main,mo,false,0,0,2.1,0.8,2.1,"Reddish brown",true,"Custom")
  338. main.CFrame = part.CFrame * CFrame.new(0.4,(part.Size.Y/2)+(main.Size.Y/2),1.1)
  339. showhp(main,part,playa)
  340. for i=0.5,1,0.5 do
  341. local pile = Instance.new("Part")
  342. prop(pile,mo,false,0,0,i,i/1.4,i,playa.teamva.Value,true,"Custom")
  343. pile.CFrame = main.CFrame * CFrame.new(0,i,0)
  344. Instance.new("CylinderMesh",pile)
  345. end
  346. playa.prods.Value = playa.prods.Value + 1
  347. end
  348.  
  349. function barrack(part,playa)
  350. local mo = Instance.new("Model",part)
  351. mo.Name = "Barracks"
  352. buildingprops(playa,mo,part,175,"Barracks")
  353. local main = Instance.new("Part")
  354. prop(main,mo,false,0,0,2.4,1,0.6,"Reddish brown",true,"Custom")
  355. main.CFrame = part.CFrame * CFrame.new(0,(part.Size.Y/2)+(main.Size.Y/2),-1.3)
  356. showhp(main,part,playa)
  357. playa.barrack.Value = main
  358. for i = math.pi/2, math.pi, math.pi/2 do
  359. local pile = main:clone()
  360. pile.Parent = mo
  361. pile.CFrame = part.CFrame * CFrame.Angles(0,i,0) * CFrame.new(0,(part.Size.Y/2)+(main.Size.Y/2),-1.3)
  362. end
  363. local pw = Instance.new("Part")
  364. prop(pw,mo,false,0,0,0.25,1.5,0.25,"Reddish brown",true,"Custom")
  365. pw.CFrame = main.CFrame * CFrame.new(0,1.1,0)
  366. Instance.new("CylinderMesh",pw)
  367. local fl = Instance.new("Part")
  368. prop(fl,mo,false,0,0,0.05,0.5,1,playa.teamva.Value,true,"Custom")
  369. fl.CFrame = main.CFrame * CFrame.new(0,1.7,0.5) * CFrame.Angles(0,math.pi,0)
  370. Instance.new("SpecialMesh",fl).MeshType = "Wedge"
  371. playa.Barras.Value = playa.Barras.Value + 1
  372. end
  373.  
  374. function bank(part,playa)
  375. local mo = Instance.new("Model",part)
  376. mo.Name = "Bank"
  377. buildingprops(playa,mo,part,600,"Bank")
  378. local main = Instance.new("Part")
  379. prop(main,mo,false,0,0,2,2,2,"Reddish brown",true,"Custom")
  380. main.CFrame = part.CFrame * CFrame.new(0.2,(part.Size.Y/2)+(main.Size.Y/2),-0.3)
  381. showhp(main,part,playa)
  382. for i = 0, math.pi, math.pi do
  383. local pile = Instance.new("Part")
  384. prop(pile,mo,false,0,0,2.4,0.8,1.25,playa.teamva.Value,true,"Custom")
  385. pile.CFrame = main.CFrame * CFrame.Angles(0,-i,0) * CFrame.new(0,1.4,-0.6)
  386. Instance.new("SpecialMesh",pile).MeshType = "Wedge"
  387. end
  388. local py = Instance.new("Part")
  389. prop(py,mo,false,0,0,0.4,0.8,0.6,"Really black",true,"Custom")
  390. py.CFrame = main.CFrame * CFrame.new(0.9,-0.6,0)
  391. coroutine.resume(coroutine.create(function()
  392. while part.Health.Value > 0 do
  393. wait(10)
  394. local df = playa.bank.Value
  395. playa.bank.Value = playa.bank.Value + df/interest
  396. end
  397. end))
  398. end
  399.  
  400. function factory(part,playa)
  401. local mo = Instance.new("Model",part)
  402. mo.Name = "Factory"
  403. buildingprops(playa,mo,part,500,"Factory")
  404. local main = Instance.new("Part")
  405. prop(main,mo,false,0,0,2.9,1.2,1.4,"Dark grey",true,"Custom")
  406. main.CFrame = part.CFrame * CFrame.new(0.5,(part.Size.Y/2)+(main.Size.Y/2),-1.1)
  407. showhp(main,part,playa)
  408. for i = -0.9, 0, 0.9 do
  409. local pile = Instance.new("Part")
  410. prop(pile,mo,false,0,0,0.7,1.2,0.7,playa.teamva.Value,true,"Custom")
  411. pile.CFrame = main.CFrame * CFrame.new(i,(main.Size.Y/2)+(pile.Size.Y/2),0.1)
  412. Instance.new("CylinderMesh",pile)
  413. end
  414. local pow = Instance.new("Part")
  415. prop(pow,mo,false,0,0,1.3,0.9,1,"Dark grey",true,"Custom")
  416. pow.CFrame = part.CFrame * CFrame.new(1.2,(part.Size.Y/2)+(pow.Size.Y/2),0)
  417. end
  418.  
  419. function tower(part,playa)
  420. local mo = Instance.new("Model",part)
  421. mo.Name = "Tower"
  422. buildingprops(playa,mo,part,95,"Tower")
  423. local main = Instance.new("Part")
  424. prop(main,mo,false,0,0,1.9,0.4,1.9,playa.teamva.Value,true,"Custom")
  425. main.CFrame = part.CFrame * CFrame.new(0,(part.Size.Y/2)+(main.Size.Y/2),0)
  426. Instance.new("CylinderMesh",main)
  427. local pow = Instance.new("Part")
  428. prop(pow,mo,false,0,0,1,3,1,"Reddish brown",true,"Custom")
  429. pow.CFrame = part.CFrame * CFrame.new(0,(part.Size.Y/2)+(pow.Size.Y/2),0)
  430. Instance.new("CylinderMesh",pow)
  431. local hu = Instance.new("Part")
  432. prop(hu,mo,false,0,0,1.4,0.2,1.4,"Reddish brown",true,"Custom")
  433. hu.CFrame = pow.CFrame * CFrame.new(0,pow.Size.Y/2,0)
  434. local hu2 = Instance.new("Part")
  435. prop(hu2,mo,false,0,0,1.6,0.2,1.6,"Reddish brown",true,"Custom")
  436. hu2.CFrame = hu.CFrame * CFrame.new(0,1.2,0)
  437. showhp(hu2,part,playa)
  438. for i=0,math.pi*2,math.pi/2 do
  439. local ha = Instance.new("Part")
  440. prop(ha,mo,false,0,0,0.1,1.2,0.1,"Reddish brown",true,"Custom")
  441. ha.CFrame = hu.CFrame * CFrame.Angles(0,i,0) * CFrame.new(0.6,ha.Size.Y/2,0.6)
  442. end
  443. coroutine.resume(coroutine.create(function()
  444. while part.Health.Value > 0 do
  445. wait(0.85)
  446. local obj,dis = getlols(model,part.Position,playa)
  447. if obj ~= nil then
  448. local trail = Instance.new("Part")
  449. prop(trail,mo,false,0.2,0,0.1,0.1,1,"Bright yellow",true,"Custom")
  450. trail.CFrame = CFrame.new(hu2.Position,obj.Position) * CFrame.new(0,0,-dis/2)
  451. local mesi = Instance.new("SpecialMesh",trail)
  452. mesi.Scale = Vector3.new(1,1,dis)
  453. mesi.MeshType = "Brick"
  454. if obj.Name == "Tile" then
  455. obj.Health.Value = obj.Health.Value - math.random(towerdmg-3,towerdmg+3)
  456. elseif obj.Name == "Unit" then
  457. obj.Amount.Value = obj.Amount.Value - 1
  458. end
  459. coroutine.resume(coroutine.create(function()
  460. for i=0.2,1,0.15 do
  461. wait()
  462. trail.Transparency = i
  463. end
  464. trail:remove()
  465. end))
  466. end
  467. end
  468. end))
  469. end
  470.  
  471. function coordinates(screen,xx,zz)
  472. local po = 10
  473. for i=1,2 do
  474. local tx = Instance.new("TextLabel",screen)
  475. tx.Size = UDim2.new(0,80,0,20)
  476. tx.Position = UDim2.new(0,po,0.25,0)
  477. if i == 1 then
  478. tx.Text = "X: "..xx
  479. else
  480. tx.Text = "Z: "..zz
  481. end
  482. po = po + tx.Size.X.Offset
  483. end
  484. end
  485.  
  486. function troops(xx,zz,ply,par)
  487. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  488. if hm ~= nil then
  489. hm:remove()
  490. end
  491. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  492. sc.Name = "Coordinates"
  493. coordinates(sc,xx,zz)
  494. local mmh = Instance.new("Frame",sc)
  495. mmh.Style = "RobloxRound"
  496. mmh.Size = UDim2.new(0.4,0,0.25,0)
  497. mmh.Position = UDim2.new(0.3,0,0.25,0)
  498. local mk = Instance.new("TextLabel",mmh)
  499. mk.Size = UDim2.new(1,0,0.15,0)
  500. mk.Position = UDim2.new(0,0,0,0)
  501. mk.FontSize = "Size14"
  502. mk.TextColor3 = Color3.new(1,1,1)
  503. mk.BackgroundTransparency = 1
  504. mk.Text = "Send/Train troops"
  505. local buttonprod = Instance.new("TextButton",mmh)
  506. buttonprod.Size = UDim2.new(0.3,0,0.15,0)
  507. buttonprod.Position = UDim2.new(0.05,0,0.25,0)
  508. buttonprod.FontSize = "Size12"
  509. buttonprod.TextColor3 = Color3.new(1,1,1)
  510. buttonprod.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  511. buttonprod.BackgroundTransparency = 0.4
  512. buttonprod.Text = "Soldier: "..soldcost
  513. buttonprod.MouseButton1Click:connect(function()
  514. if ply.Gaah.Value > soldcost-1 and ply.Trawps.Value < ply.Barras.Value*eachbarrack then
  515. ply.Gaah.Value = ply.Gaah.Value - soldcost
  516. ply.Trawps.Value = ply.Trawps.Value + 1
  517. end
  518. end)
  519. local buttonpr = Instance.new("TextButton",mmh)
  520. buttonpr.Size = UDim2.new(0.3,0,0.15,0)
  521. buttonpr.Position = UDim2.new(0.65,0,0.25,0)
  522. buttonpr.FontSize = "Size12"
  523. buttonpr.TextColor3 = Color3.new(1,1,1)
  524. buttonpr.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  525. buttonpr.BackgroundTransparency = 0.4
  526. buttonpr.Text = "Send soldiers"
  527. buttonpr.TextWrap = true
  528. local clicka = 1
  529. buttonpr.MouseButton1Click:connect(function()
  530. if clicka == 1 then
  531. buttonpr.FontSize = "Size8"
  532. buttonpr.Size = UDim2.new(0.45,0,0.4,0)
  533. buttonpr.Text = [[Touch a brick where you want to attack]]
  534. ply.Attwk.Value = true
  535. end
  536. end)
  537. local butto = Instance.new("TextButton",mmh)
  538. butto.Size = UDim2.new(0.3,0,0.15,0)
  539. butto.Position = UDim2.new(0.35,0,0.5,0)
  540. butto.FontSize = "Size12"
  541. butto.TextColor3 = Color3.new(1,1,1)
  542. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  543. butto.BackgroundTransparency = 0.4
  544. butto.Text = "Sell"
  545. butto.MouseButton1Click:connect(function()
  546. giveresources(ply,barcost/2,par)
  547. for _,v in pairs(par:children()) do
  548. if not v:IsA("TouchTransmitter") and v.className ~= "BillboardGui" then
  549. v:remove()
  550. end
  551. end
  552. sc:remove()
  553. end)
  554. local close = Instance.new("TextButton",mmh)
  555. close.Size = UDim2.new(0.4,0,0.2,0)
  556. close.Position = UDim2.new(0.3,0,0.7,0)
  557. close.FontSize = "Size12"
  558. close.TextColor3 = Color3.new(1,1,1)
  559. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  560. close.BackgroundTransparency = 0.4
  561. close.Text = "Close"
  562. close.MouseButton1Click:connect(function()
  563. sc:remove()
  564. ply.Attwk.Value = false
  565. end)
  566. end
  567.  
  568. function close(xx,zz,ply,par)
  569. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  570. if hm ~= nil then
  571. hm:remove()
  572. end
  573. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  574. sc.Name = "Coordinates"
  575. coordinates(sc,xx,zz)
  576. local mmh = Instance.new("Frame",sc)
  577. mmh.Style = "RobloxRound"
  578. mmh.Size = UDim2.new(0.4,0,0.25,0)
  579. mmh.Position = UDim2.new(0.3,0,0.25,0)
  580. local mk = Instance.new("TextLabel",mmh)
  581. mk.Size = UDim2.new(1,0,0.15,0)
  582. mk.Position = UDim2.new(0,0,0,0)
  583. mk.FontSize = "Size14"
  584. mk.TextColor3 = Color3.new(1,1,1)
  585. mk.BackgroundTransparency = 1
  586. mk.Text = "Sell building"
  587. local butto = Instance.new("TextButton",mmh)
  588. butto.Size = UDim2.new(0.3,0,0.15,0)
  589. butto.Position = UDim2.new(0.35,0,0.4,0)
  590. butto.FontSize = "Size12"
  591. butto.TextColor3 = Color3.new(1,1,1)
  592. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  593. butto.BackgroundTransparency = 0.4
  594. butto.Text = "Sell"
  595. butto.MouseButton1Click:connect(function()
  596. giveresources(ply,prodcost/2,par)
  597. for _,v in pairs(par:children()) do
  598. if not v:IsA("TouchTransmitter") and v.className ~= "BillboardGui" then
  599. v:remove()
  600. end
  601. end
  602. sc:remove()
  603. end)
  604. local close = Instance.new("TextButton",mmh)
  605. close.Size = UDim2.new(0.4,0,0.2,0)
  606. close.Position = UDim2.new(0.3,0,0.7,0)
  607. close.FontSize = "Size12"
  608. close.TextColor3 = Color3.new(1,1,1)
  609. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  610. close.BackgroundTransparency = 0.4
  611. close.Text = "Close"
  612. close.MouseButton1Click:connect(function()
  613. sc:remove()
  614. ply.Attwk.Value = false
  615. end)
  616. end
  617.  
  618. function close2(xx,zz,ply,par)
  619. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  620. if hm ~= nil then
  621. hm:remove()
  622. end
  623. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  624. sc.Name = "Coordinates"
  625. coordinates(sc,xx,zz)
  626. local mmh = Instance.new("Frame",sc)
  627. mmh.Style = "RobloxRound"
  628. mmh.Size = UDim2.new(0.4,0,0.25,0)
  629. mmh.Position = UDim2.new(0.3,0,0.25,0)
  630. local mk = Instance.new("TextLabel",mmh)
  631. mk.Size = UDim2.new(1,0,0.15,0)
  632. mk.Position = UDim2.new(0,0,0,0)
  633. mk.FontSize = "Size14"
  634. mk.TextColor3 = Color3.new(1,1,1)
  635. mk.BackgroundTransparency = 1
  636. mk.Text = "Sell building"
  637. local butto = Instance.new("TextButton",mmh)
  638. butto.Size = UDim2.new(0.3,0,0.15,0)
  639. butto.Position = UDim2.new(0.35,0,0.4,0)
  640. butto.FontSize = "Size12"
  641. butto.TextColor3 = Color3.new(1,1,1)
  642. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  643. butto.BackgroundTransparency = 0.4
  644. butto.Text = "Sell"
  645. butto.MouseButton1Click:connect(function()
  646. giveresources(ply,towercost/2,par)
  647. for _,v in pairs(par:children()) do
  648. if not v:IsA("TouchTransmitter") and v.className ~= "BillboardGui" then
  649. v:remove()
  650. end
  651. end
  652. sc:remove()
  653. end)
  654. local close = Instance.new("TextButton",mmh)
  655. close.Size = UDim2.new(0.4,0,0.2,0)
  656. close.Position = UDim2.new(0.3,0,0.7,0)
  657. close.FontSize = "Size12"
  658. close.TextColor3 = Color3.new(1,1,1)
  659. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  660. close.BackgroundTransparency = 0.4
  661. close.Text = "Close"
  662. close.MouseButton1Click:connect(function()
  663. sc:remove()
  664. ply.Attwk.Value = false
  665. end)
  666. end
  667.  
  668. function bankscreen(xx,zz,ply,par)
  669. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  670. if hm ~= nil then
  671. hm:remove()
  672. end
  673. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  674. sc.Name = "Coordinates"
  675. coordinates(sc,xx,zz)
  676. local mmh = Instance.new("Frame",sc)
  677. mmh.Style = "RobloxRound"
  678. mmh.Size = UDim2.new(0.4,0,0.25,0)
  679. mmh.Position = UDim2.new(0.3,0,0.25,0)
  680. local mk = Instance.new("TextLabel",mmh)
  681. mk.Size = UDim2.new(1,0,0.15,0)
  682. mk.Position = UDim2.new(0,0,0,0)
  683. mk.FontSize = "Size14"
  684. mk.TextColor3 = Color3.new(1,1,1)
  685. mk.BackgroundTransparency = 1
  686. mk.Text = "Bank: "..ply.bank.Value
  687. ply.bank.Changed:connect(function(prop)
  688. mk.Text = "Bank: "..ply.bank.Value
  689. end)
  690. local butto = Instance.new("TextButton",mmh)
  691. butto.Size = UDim2.new(0.3,0,0.15,0)
  692. butto.Position = UDim2.new(0.35,0,0.6,0)
  693. butto.FontSize = "Size12"
  694. butto.TextColor3 = Color3.new(1,1,1)
  695. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  696. butto.BackgroundTransparency = 0.4
  697. butto.Text = "Sell"
  698. butto.MouseButton1Click:connect(function()
  699. giveresources(ply,(bankcost/2)+ply.bank.Value,par)
  700. ply.bank.Value = 0
  701. for _,v in pairs(par:children()) do
  702. if not v:IsA("TouchTransmitter") and v.className ~= "BillboardGui" then
  703. v:remove()
  704. end
  705. end
  706. sc:remove()
  707. end)
  708. local but = Instance.new("TextButton",mmh)
  709. but.Size = UDim2.new(0.3,0,0.15,0)
  710. but.Position = UDim2.new(0.1,0,0.4,0)
  711. but.FontSize = "Size12"
  712. but.TextColor3 = Color3.new(1,1,1)
  713. but.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  714. but.BackgroundTransparency = 0.4
  715. but.Text = "Deposit"
  716. local steal = Instance.new("TextButton",mmh)
  717. steal.Size = UDim2.new(0.3,0,0.15,0)
  718. steal.Position = UDim2.new(0.6,0,0.4,0)
  719. steal.FontSize = "Size12"
  720. steal.TextColor3 = Color3.new(1,1,1)
  721. steal.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  722. steal.BackgroundTransparency = 0.4
  723. steal.Text = "Withdraw"
  724. local txtbox = Instance.new("TextBox",mmh)
  725. txtbox.Size = UDim2.new(0.16,0,0.1,0)
  726. txtbox.Position = UDim2.new(0.42,0,0.3,0)
  727. txtbox.FontSize = "Size12"
  728. txtbox.TextColor3 = Color3.new(1,1,1)
  729. txtbox.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  730. txtbox.BackgroundTransparency = 0.4
  731. txtbox.Text = 0
  732. but.MouseButton1Click:connect(function()
  733. local numba = txtbox.Text
  734. if tonumber(numba) then
  735. if tonumber(numba) > 0 and tonumber(numba) < ply.Gaah.Value+1 then
  736. ply.Gaah.Value = ply.Gaah.Value - numba
  737. ply.bank.Value = ply.bank.Value + numba
  738. end
  739. end
  740. end)
  741. steal.MouseButton1Click:connect(function()
  742. local numba = txtbox.Text
  743. if tonumber(numba) then
  744. if tonumber(numba) > 0 and tonumber(numba) < ply.bank.Value+1 then
  745. ply.Gaah.Value = ply.Gaah.Value + numba
  746. ply.bank.Value = ply.bank.Value - numba
  747. end
  748. end
  749. end)
  750. local close = Instance.new("TextButton",mmh)
  751. close.Size = UDim2.new(0.4,0,0.2,0)
  752. close.Position = UDim2.new(0.3,0,0.78,0)
  753. close.FontSize = "Size12"
  754. close.TextColor3 = Color3.new(1,1,1)
  755. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  756. close.BackgroundTransparency = 0.4
  757. close.Text = "Close"
  758. close.MouseButton1Click:connect(function()
  759. sc:remove()
  760. ply.Attwk.Value = false
  761. end)
  762. end
  763.  
  764. function factoryscreen(xx,zz,ply,par)
  765. ply.evrytin.Value = true
  766. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  767. if hm ~= nil then
  768. hm:remove()
  769. end
  770. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  771. sc.Name = "Coordinates"
  772. coordinates(sc,xx,zz)
  773. local mmh = Instance.new("Frame",sc)
  774. mmh.Style = "RobloxRound"
  775. mmh.Size = UDim2.new(0.4,0,0.25,0)
  776. mmh.Position = UDim2.new(0.3,0,0.25,0)
  777. local mk = Instance.new("TextLabel",mmh)
  778. mk.Size = UDim2.new(1,0,0.15,0)
  779. mk.Position = UDim2.new(0,0,0,0)
  780. mk.FontSize = "Size14"
  781. mk.TextColor3 = Color3.new(1,1,1)
  782. mk.BackgroundTransparency = 1
  783. mk.Text = "Factory: Bombs and heavy"
  784. local buttonprod = Instance.new("TextButton",mmh)
  785. buttonprod.Size = UDim2.new(0.3,0,0.15,0)
  786. buttonprod.Position = UDim2.new(0.05,0,0.25,0)
  787. buttonprod.FontSize = "Size12"
  788. buttonprod.TextColor3 = Color3.new(1,1,1)
  789. buttonprod.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  790. buttonprod.BackgroundTransparency = 0.4
  791. buttonprod.Text = "Drop bomb: "..bombcost
  792. buttonprod.MouseButton1Click:connect(function()
  793. if ply.Gaah.Value > bombcost-1 then
  794. ply.Gaah.Value = ply.Gaah.Value - bombcost
  795. local bewm = Instance.new("Part")
  796. prop(bewm,model,false,0,0,1,3,1,"Navy blue",false,"Custom")
  797. bewm.CFrame = CFrame.new(ply.Character.Torso.CFrame.x,60,ply.Character.Torso.CFrame.z)
  798. repeat wait() until bewm.Position.Y < lolok.y+1
  799. local boo = Instance.new("Part")
  800. prop(boo,model,false,0.3,0,1,1,1,bombcolors[math.random(1,#bombcolors)],true,"Custom")
  801. boo.CFrame = CFrame.new(bewm.Position.X, lolok.y,bewm.Position.Z)
  802. local mi = Instance.new("SpecialMesh",boo)
  803. mi.MeshType = "Sphere"
  804. coroutine.resume(coroutine.create(function()
  805. for i=1, bombdist*2, 1.4 do
  806. wait()
  807. mi.Scale = Vector3.new(i,i,i)
  808. boo.Transparency = i/(bombdist*2)
  809. end
  810. boo:remove()
  811. end))
  812. for _,v in pairs(model:children()) do
  813. if v:IsA("BasePart") then
  814. if v:findFirstChild("Health") then
  815. if (v.Position - boo.Position).magnitude < bombdist then
  816. local helt = v.Health
  817. helt.Value = helt.Value - math.random(bombd - 20, bombd + 20)
  818. end
  819. end
  820. end
  821. end
  822. bewm:remove()
  823. end
  824. end)
  825. local butto = Instance.new("TextButton",mmh)
  826. butto.Size = UDim2.new(0.3,0,0.15,0)
  827. butto.Position = UDim2.new(0.35,0,0.5,0)
  828. butto.FontSize = "Size12"
  829. butto.TextColor3 = Color3.new(1,1,1)
  830. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  831. butto.BackgroundTransparency = 0.4
  832. butto.Text = "Sell"
  833. butto.MouseButton1Click:connect(function()
  834. ply.evrytin.Value = false
  835. giveresources(ply,barcost/2,par)
  836. for _,v in pairs(par:children()) do
  837. if not v:IsA("TouchTransmitter") and v.className ~= "BillboardGui" then
  838. v:remove()
  839. end
  840. end
  841. sc:remove()
  842. end)
  843. local close = Instance.new("TextButton",mmh)
  844. close.Size = UDim2.new(0.4,0,0.2,0)
  845. close.Position = UDim2.new(0.3,0,0.7,0)
  846. close.FontSize = "Size12"
  847. close.TextColor3 = Color3.new(1,1,1)
  848. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  849. close.BackgroundTransparency = 0.4
  850. close.Text = "Close"
  851. close.MouseButton1Click:connect(function()
  852. sc:remove()
  853. ply.evrytin.Value = false
  854. end)
  855. end
  856.  
  857. function attack(xx,zz,ply,par)
  858. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  859. if hm ~= nil then
  860. hm:remove()
  861. end
  862. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  863. sc.Name = "Coordinates"
  864. coordinates(sc,xx,zz)
  865. local mmh = Instance.new("Frame",sc)
  866. mmh.Style = "RobloxRound"
  867. mmh.Size = UDim2.new(0.4,0,0.25,0)
  868. mmh.Position = UDim2.new(0.3,0,0.25,0)
  869. local mk = Instance.new("TextLabel",mmh)
  870. mk.Size = UDim2.new(1,0,0.15,0)
  871. mk.Position = UDim2.new(0,0,0,0)
  872. mk.FontSize = "Size14"
  873. mk.TextColor3 = Color3.new(1,1,1)
  874. mk.BackgroundTransparency = 1
  875. mk.Text = par.Owner.Value.."'s "..par.Type.Value
  876. local butto = Instance.new("TextButton",mmh)
  877. butto.Size = UDim2.new(0.3,0,0.15,0)
  878. butto.Position = UDim2.new(0.1,0,0.5,0)
  879. butto.FontSize = "Size12"
  880. butto.TextColor3 = Color3.new(1,1,1)
  881. butto.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  882. butto.BackgroundTransparency = 0.4
  883. butto.Text = "Attack"
  884. local steal = Instance.new("TextButton",mmh)
  885. steal.Size = UDim2.new(0.3,0,0.15,0)
  886. steal.Position = UDim2.new(0.6,0,0.5,0)
  887. steal.FontSize = "Size12"
  888. steal.TextColor3 = Color3.new(1,1,1)
  889. steal.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  890. steal.BackgroundTransparency = 0.4
  891. steal.Text = "Steal"
  892. local txtbox = Instance.new("TextBox",mmh)
  893. txtbox.Size = UDim2.new(0.16,0,0.1,0)
  894. txtbox.Position = UDim2.new(0.42,0,0.4,0)
  895. txtbox.FontSize = "Size12"
  896. txtbox.TextColor3 = Color3.new(1,1,1)
  897. txtbox.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  898. txtbox.BackgroundTransparency = 0.4
  899. txtbox.Text = 1
  900. butto.MouseButton1Click:connect(function()
  901. local numba = txtbox.Text
  902. if tonumber(numba) then
  903. if tonumber(numba) > 0 and tonumber(numba) < ply.Trawps.Value+1 then
  904. giveresources(ply,-numba*3,ply.barrack.Value)
  905. ply.Trawps.Value = ply.Trawps.Value - numba
  906. local pew = Instance.new("Part")
  907. prop(pew,model,true,0.1,0,1,4.5,0.6,ply.teamva.Value,true,"Custom")
  908. pew.CFrame = CFrame.new(ply.barrack.Value.Position, par.Position)
  909. pew.Name = "Unit"
  910. local ow = Instance.new("StringValue",pew)
  911. ow.Name = "Ownah"
  912. ow.Value = ply.Name
  913. local va = Instance.new("IntValue",pew)
  914. va.Value = numba
  915. va.Name = "Amount"
  916. va.Changed:connect(function(pro)
  917. if va.Value < 1 then
  918. pew:remove()
  919. end
  920. end)
  921. coroutine.resume(coroutine.create(function()
  922. wait(35)
  923. pew:remove()
  924. end))
  925. local bil = Instance.new("BillboardGui",pew)
  926. bil.Adornee = pew
  927. bil.Size = UDim2.new(0,40,0,40)
  928. local txl = Instance.new("TextLabel",bil)
  929. txl.Size = bil.Size
  930. txl.BackgroundTransparency = 1
  931. txl.TextColor3 = Color3.new(0.6,0,0)
  932. txl.FontSize = "Size18"
  933. txl.Text = va.Value.." S"
  934. txl.Position = UDim2.new(0,0,0,-55)
  935. local op = game.Players:findFirstChild(par.Owner.Value)
  936. repeat
  937. pew.CFrame = pew.CFrame * CFrame.new(0,0,-0.24)
  938. txl.Text = va.Value.." S"
  939. wait()
  940. until (pew.Position - par.Position).magnitude < 3
  941. local mk2 = op.Trawps.Value
  942. local diff = mk2 - va.Value
  943. local retu = va.Value - mk2
  944. va.Value = retu
  945. op.Trawps.Value = diff
  946. par.Health.Value = par.Health.Value - (va.Value*soldmg)
  947. if diff < 1 then
  948. op.Trawps.Value = 0
  949. end
  950. if retu < 1 then
  951. pew:remove()
  952. else
  953. txl.Text = va.Value.." S"
  954. pew.CFrame = CFrame.new(par.Position, ply.barrack.Value.Position) * CFrame.new(0,0,-2.5)
  955. repeat
  956. pew.CFrame = pew.CFrame * CFrame.new(0,0,-0.24)
  957. txl.Text = va.Value.." S"
  958. wait()
  959. until (pew.Position - ply.barrack.Value.Position).magnitude < 2
  960. ply.Trawps.Value = ply.Trawps.Value + va.Value
  961. pew:remove()
  962. end
  963. end
  964. end
  965. end)
  966. steal.MouseButton1Click:connect(function()
  967. local numba = txtbox.Text
  968. if tonumber(numba) then
  969. if tonumber(numba) > 0 and tonumber(numba) < ply.Trawps.Value+1 then
  970. giveresources(ply,-numba,par)
  971. ply.Trawps.Value = ply.Trawps.Value - numba
  972. local pew = Instance.new("Part")
  973. prop(pew,model,true,0.1,0,1,4.5,0.6,ply.teamva.Value,true,"Custom")
  974. pew.CFrame = CFrame.new(ply.barrack.Value.Position, par.Position)
  975. pew.Name = "Unit"
  976. local va = Instance.new("IntValue",pew)
  977. va.Value = numba
  978. va.Name = "Amount"
  979. local vah = Instance.new("StringValue",pew)
  980. vah.Value = ply.Name
  981. vah.Name = "Ownah"
  982. va.Changed:connect(function(pro)
  983. if va.Value < 1 then
  984. pew:remove()
  985. end
  986. end)
  987. coroutine.resume(coroutine.create(function()
  988. wait(25)
  989. pew:remove()
  990. end))
  991. local bil = Instance.new("BillboardGui",pew)
  992. bil.Adornee = pew
  993. bil.Size = UDim2.new(0,40,0,40)
  994. local txl = Instance.new("TextLabel",bil)
  995. txl.Size = bil.Size
  996. txl.BackgroundTransparency = 1
  997. txl.TextColor3 = Color3.new(0,0,0)
  998. txl.FontSize = "Size18"
  999. txl.Text = va.Value.." T"
  1000. txl.Position = UDim2.new(0,0,0,-55)
  1001. local op = game.Players:findFirstChild(par.Owner.Value)
  1002. repeat
  1003. pew.CFrame = pew.CFrame * CFrame.new(0,0,-0.5)
  1004. txl.Text = va.Value.." T"
  1005. wait()
  1006. until (pew.Position - par.Position).magnitude < 3
  1007. local nu = math.floor((op.Gaah.Value/stealamount)*va.Value)
  1008. giveresources(op,-nu,par)
  1009. pew.CFrame = CFrame.new(par.Position, ply.barrack.Value.Position) * CFrame.new(0,0,-2.5)
  1010. repeat
  1011. pew.CFrame = pew.CFrame * CFrame.new(0,0,-0.5)
  1012. txl.Text = va.Value.." T"
  1013. wait()
  1014. until (pew.Position - ply.barrack.Value.Position).magnitude < 3
  1015. giveresources(ply,nu,ply.barrack.Value)
  1016. ply.Trawps.Value = ply.Trawps.Value + va.Value
  1017. pew:remove()
  1018. end
  1019. end
  1020. end)
  1021. local close = Instance.new("TextButton",mmh)
  1022. close.Size = UDim2.new(0.4,0,0.2,0)
  1023. close.Position = UDim2.new(0.3,0,0.7,0)
  1024. close.FontSize = "Size12"
  1025. close.TextColor3 = Color3.new(1,1,1)
  1026. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1027. close.BackgroundTransparency = 0.4
  1028. close.Text = "Nvm, close"
  1029. close.MouseButton1Click:connect(function()
  1030. sc:remove()
  1031. ply.Attwk.Value = false
  1032. end)
  1033. end
  1034.  
  1035. function build(xx,zz,ply,par)
  1036. local hm = ply.PlayerGui:findFirstChild("Coordinates")
  1037. if hm ~= nil then
  1038. hm:remove()
  1039. end
  1040. local sc = Instance.new("ScreenGui",ply.PlayerGui)
  1041. sc.Name = "Coordinates"
  1042. coordinates(sc,xx,zz)
  1043. local mmh = Instance.new("Frame",sc)
  1044. mmh.Style = "RobloxRound"
  1045. mmh.Size = UDim2.new(0.4,0,0.25,0)
  1046. mmh.Position = UDim2.new(0.3,0,0.25,0)
  1047. local mk = Instance.new("TextLabel",mmh)
  1048. mk.Size = UDim2.new(1,0,0.15,0)
  1049. mk.Position = UDim2.new(0,0,0,0)
  1050. mk.FontSize = "Size14"
  1051. mk.TextColor3 = Color3.new(1,1,1)
  1052. mk.BackgroundTransparency = 1
  1053. mk.Text = "What you wanna do/build?"
  1054. local buttonprod = Instance.new("TextButton",mmh)
  1055. buttonprod.Size = UDim2.new(0.3,0,0.15,0)
  1056. buttonprod.Position = UDim2.new(0.05,0,0.25,0)
  1057. buttonprod.FontSize = "Size12"
  1058. buttonprod.TextColor3 = Color3.new(1,1,1)
  1059. buttonprod.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1060. buttonprod.BackgroundTransparency = 0.4
  1061. buttonprod.Text = "Producer: "..prodcost
  1062. buttonprod.MouseButton1Click:connect(function()
  1063. if par:findFirstChild("Owner") == nil then
  1064. if ply.Gaah.Value > prodcost-1 then
  1065. ply.Gaah.Value = ply.Gaah.Value - prodcost
  1066. producer(par,ply)
  1067. end
  1068. sc:remove()
  1069. end
  1070. end)
  1071. local buttonbar = Instance.new("TextButton",mmh)
  1072. buttonbar.Size = UDim2.new(0.3,0,0.15,0)
  1073. buttonbar.Position = UDim2.new(0.65,0,0.25,0)
  1074. buttonbar.FontSize = "Size12"
  1075. buttonbar.TextColor3 = Color3.new(1,1,1)
  1076. buttonbar.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1077. buttonbar.BackgroundTransparency = 0.4
  1078. buttonbar.Text = "Barracks: "..barcost
  1079. buttonbar.MouseButton1Click:connect(function()
  1080. if par:findFirstChild("Owner") == nil then
  1081. if ply.Gaah.Value > barcost-1 then
  1082. ply.Gaah.Value = ply.Gaah.Value - barcost
  1083. barrack(par,ply)
  1084. end
  1085. sc:remove()
  1086. end
  1087. end)
  1088. local buttonban = Instance.new("TextButton",mmh)
  1089. buttonban.Size = UDim2.new(0.3,0,0.15,0)
  1090. buttonban.Position = UDim2.new(0.35,0,0.25,0)
  1091. buttonban.FontSize = "Size12"
  1092. buttonban.TextColor3 = Color3.new(1,1,1)
  1093. buttonban.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1094. buttonban.BackgroundTransparency = 0.4
  1095. buttonban.Text = "Bank: "..bankcost
  1096. buttonban.MouseButton1Click:connect(function()
  1097. if par:findFirstChild("Owner") == nil then
  1098. if ply.Gaah.Value > bankcost-1 then
  1099. ply.Gaah.Value = ply.Gaah.Value - bankcost
  1100. bank(par,ply)
  1101. end
  1102. sc:remove()
  1103. end
  1104. end)
  1105. local buttf = Instance.new("TextButton",mmh)
  1106. buttf.Size = UDim2.new(0.3,0,0.15,0)
  1107. buttf.Position = UDim2.new(0.05,0,0.42,0)
  1108. buttf.FontSize = "Size12"
  1109. buttf.TextColor3 = Color3.new(1,1,1)
  1110. buttf.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1111. buttf.BackgroundTransparency = 0.4
  1112. buttf.Text = "Factory: "..factorycost
  1113. buttf.MouseButton1Click:connect(function()
  1114. if par:findFirstChild("Owner") == nil then
  1115. if ply.Gaah.Value > factorycost-1 then
  1116. ply.Gaah.Value = ply.Gaah.Value - factorycost
  1117. factory(par,ply)
  1118. end
  1119. sc:remove()
  1120. end
  1121. end)
  1122. local buttff = Instance.new("TextButton",mmh)
  1123. buttff.Size = UDim2.new(0.3,0,0.15,0)
  1124. buttff.Position = UDim2.new(0.35,0,0.42,0)
  1125. buttff.FontSize = "Size12"
  1126. buttff.TextColor3 = Color3.new(1,1,1)
  1127. buttff.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1128. buttff.BackgroundTransparency = 0.4
  1129. buttff.Text = "Tower: "..towercost
  1130. buttff.MouseButton1Click:connect(function()
  1131. if par:findFirstChild("Owner") == nil then
  1132. if ply.Gaah.Value > towercost-1 then
  1133. ply.Gaah.Value = ply.Gaah.Value - towercost
  1134. tower(par,ply)
  1135. end
  1136. sc:remove()
  1137. end
  1138. end)
  1139. local close = Instance.new("TextButton",mmh)
  1140. close.Size = UDim2.new(0.4,0,0.2,0)
  1141. close.Position = UDim2.new(0.3,0,0.7,0)
  1142. close.FontSize = "Size12"
  1143. close.TextColor3 = Color3.new(1,1,1)
  1144. close.BackgroundColor3 = Color3.new(0.2,0.2,0.3)
  1145. close.BackgroundTransparency = 0.4
  1146. close.Text = "Close"
  1147. close.MouseButton1Click:connect(function()
  1148. sc:remove()
  1149. end)
  1150. end
  1151.  
  1152. atm = 1
  1153. x = 40
  1154. z = 40
  1155. max = x*2.5
  1156.  
  1157. repeat
  1158. local dx = x
  1159. local dz = z
  1160. local si = math.random(50,240)/100
  1161. local p = Instance.new("Part")
  1162. prop(p,model,true,0,0,5,si,5,terraincolors[math.random(1,#terraincolors)],true,"Custom")
  1163. p.CFrame = basecf * lolpos * CFrame.new(x,p.Size.Y/2,z) * CFrame.Angles(0,math.rad(math.random(0,4)*90),0)
  1164. p.Name = "Tile"
  1165. if x == 40 and z == 40 then
  1166. mainbase(p,people[atm])
  1167. atm = atm + 1
  1168. elseif x == max and atm == 2 and players > 1 then
  1169. mainbase(p,people[atm])
  1170. atm = atm + 1
  1171. elseif z == max and atm == 3 and players > 2 then
  1172. mainbase(p,people[atm])
  1173. atm = atm + 1
  1174. elseif x == max and atm == 4 and players > 3 then
  1175. mainbase(p,people[atm])
  1176. end
  1177. x = x + p.Size.X
  1178. if x > max then
  1179. x = 40
  1180. z = z + p.Size.Z
  1181. end
  1182. p.Touched:connect(function(hit)
  1183. local plyr = nil
  1184. local num = 0
  1185. for _,v in pairs(people) do
  1186. if v.Name == hit.Parent.Name then
  1187. num = num + 1
  1188. plyr = v
  1189. end
  1190. end
  1191. if num > 0 then
  1192. local own = p:findFirstChild("Owner")
  1193. if own == nil then
  1194. if plyr.Attwk.Value == false and plyr.evrytin.Value == false then
  1195. build(dx,dz,plyr,p)
  1196. end
  1197. else
  1198. if own.Value ~= plyr.Name then
  1199. if plyr.Attwk.Value then
  1200. attack(dx,dz,plyr,p)
  1201. end
  1202. else
  1203. if plyr.Attwk.Value == false and plyr.evrytin.Value == false then
  1204. if p.Type.Value ~= "Main base" then
  1205. if p.Type.Value == "Barracks" then
  1206. troops(dx,dz,plyr,p)
  1207. elseif p.Type.Value == "Producer" then
  1208. close(dx,dz,plyr,p)
  1209. elseif p.Type.Value == "Tower" then
  1210. close2(dx,dz,plyr,p)
  1211. elseif p.Type.Value == "Bank" then
  1212. bankscreen(dx,dz,plyr,p)
  1213. elseif p.Type.Value == "Factory" then
  1214. factoryscreen(dx,dz,plyr,p)
  1215. end
  1216. end
  1217. end
  1218. end
  1219. end
  1220. end
  1221. end)
  1222. until z > max
  1223. wait(0.4)
  1224. for _,v in pairs(people) do
  1225. v.Character:MoveTo(v.mainbas.Value.Position)
  1226. end
  1227. script.Parent = model
  1228. -- lego
  1229.  
  1230. local brikkeh = Instance.new("Part")
  1231. prop(brikkeh,model,false,0,0,1,1,1,"White",true,"Custom")
  1232. brikkeh.CFrame = basecf * lolpos * CFrame.new(x+30,0,z-30)
  1233. local sound = Instance.new("Sound",brikkeh)
  1234. sound.Volume = 0.8
  1235. sound.Pitch = 1
  1236. sound.SoundId = ""
  1237. soundids = {"http://www.roblox.com/asset/?id=11420933", "http://www.roblox.com/asset/?id=27697735",
  1238. "http://www.roblox.com/asset/?id=11420922", "http://www.roblox.com/asset/?id=1280414",
  1239. "http://www.roblox.com/asset/?id=1015394", "http://www.roblox.com/asset/?id=1372261",
  1240. "http://www.roblox.com/asset/?id=1034065", "http://www.roblox.com/asset/?id=27697743"}
  1241. pitches = {1,3,1,1,1,1,1,3.4}
  1242.  
  1243. wheregoing = 1
  1244.  
  1245. coroutine.resume(coroutine.create(function()
  1246. while true do
  1247. sound.SoundId = soundids[wheregoing]
  1248. sound.Pitch = pitches[wheregoing]
  1249. wait(0.2)
  1250. sound:play()
  1251. wait(65)
  1252. sound:stop()
  1253. wheregoing = wheregoing + 1
  1254. if wheregoing > #pitches then
  1255. wheregoing = 1
  1256. end
  1257. wait(2)
  1258. end
  1259. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement