Advertisement
UnoPastes

Geo

Mar 17th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.80 KB | None | 0 0
  1. -- RBX.Lua | Geometrical Gui | By Cass
  2.  
  3. local c = {}
  4.  
  5. local n = Instance.new
  6. local t = type
  7. local ud = 'userdata'
  8.  
  9. function c:Part(P,s)
  10. local p = n('Part',P)
  11. p.formFactor = 'Custom'
  12. if t(s) == ud then p.Size = s
  13. elseif t(s) == 'table' then p.Size = Vector3.new(s[1],s[2],s[3]) end
  14. p:BreakJoints()
  15. return p
  16. end
  17.  
  18. function c:Part3(P,s)
  19. local p = c:Part(P,s)
  20. local m = n("SpecialMesh",p)
  21. m.MeshId = "rbxassetid://9856898"
  22. m.TextureId = "rbxassetid://48358980"
  23. p.Changed:connect(function()
  24. m.Scale = p.Size * 2
  25. end)
  26. return p,m
  27. end
  28.  
  29. Player = game:GetService("Players").LocalPlayer
  30.  
  31. pcall(function()
  32. Player.PlayerGui.G:Destroy()
  33. end)
  34.  
  35. function HSVtoRGB(h,s,v)
  36. local c = v * s
  37. local x = c * (1 - math.abs(h/60%2-1))
  38. local m = v - c
  39. local r = 0
  40. local g = 0
  41. local b = 0
  42. if h >= 0 and h < 60 then
  43. r = c ; g = x
  44. elseif h >= 60 and h < 120 then
  45. r = x ; g = c
  46. elseif h >= 120 and h < 180 then
  47. g = c ; b = x
  48. elseif h >= 180 and h < 240 then
  49. g = x ; b = c
  50. elseif h >= 240 and h < 300 then
  51. r = x ; b = c
  52. elseif h >= 300 and h < 360 then
  53. r = c ; b = x
  54. end
  55.  
  56. r = r+m
  57. g = g+m
  58. b = b+m
  59.  
  60. return r,g,b
  61. end
  62.  
  63. Screen = Instance.new("ScreenGui",Player.PlayerGui)
  64. Screen.Name = "G"
  65.  
  66. function TextLabel(Pa,S,Po,Color)
  67. local T = Instance.new("TextLabel",Pa)
  68. T.Size = S
  69. T.Position = Po
  70. T.BackgroundColor3 = Color
  71. T.Text = ""
  72. T.BorderSizePixel = 0
  73. return T
  74. end
  75.  
  76. function TextButton(Pa,S,Po,Color)
  77. local T = Instance.new("TextButton",Pa)
  78. T.Size = S
  79. T.Position = Po
  80. T.BackgroundColor3 = Color
  81. T.BorderColor3 = Color
  82. T.Text = ""
  83. return T
  84. end
  85.  
  86. function TextBox(Pa,S,Po,Color)
  87. local T = Instance.new("TextBox",Pa)
  88. T.Size = S
  89. T.Position = Po
  90. T.BackgroundColor3 = Color
  91. T.BorderColor3 = Color
  92. T.Text = ""
  93. return T
  94. end
  95.  
  96. function Frame(Pa,S,Po)
  97. local T = Instance.new("Frame",Pa)
  98. T.Size = S
  99. T.Position = Po
  100. T.BackgroundColor3 = Color3.new(1,1,1)
  101. T.BorderSizePixel = 0
  102. return T
  103. end
  104.  
  105. local BarScreen = Frame(Screen,UDim2.new(.15,0,2,0),UDim2.new(.888,0,-1,0))
  106. BarScreen.BackgroundTransparency = 0.5
  107.  
  108. local WS = Frame(Screen,UDim2.new(.172,0,.335,0),UDim2.new(.715,0,.665,0))
  109.  
  110. local TStick = 3
  111. local WantedColor = Color3.new(.5,.5,.8)
  112.  
  113. local MStick = {}
  114. local Angles = {
  115. {
  116. 0,60,0
  117. },
  118. {
  119. 0.5,0,0
  120. },
  121. {
  122. 0,1,0
  123. },
  124. {
  125. 0,0,0
  126. },
  127. {
  128. 0,0,0
  129. },
  130. {
  131. 0,0,0
  132. },
  133. {
  134. 0,0,0
  135. },
  136. }
  137.  
  138. function reVisible(Number)
  139. for i = 1,7 do
  140. if i > Number then
  141. MStick[i].Visible = false
  142. elseif i <= Number then
  143. MStick[i].Visible = true
  144. end
  145. end
  146. end
  147.  
  148. function CreateGeometry()
  149. Centre = Player.Character.Torso.CFrame
  150. pcall(function()
  151. Player.Character["Geometry"..Player.Name]:Destroy()
  152. end)
  153. local Boss = Instance.new("Model",Player.Character)
  154. Boss.Name = "Geometry"..Player.Name
  155. local OldPart = nil
  156. local FirstPart = nil
  157. local Parts = {}
  158. local MyAngles = {}
  159. local ModifyAngle = {}
  160. local MyCentre = Centre * CFrame.new(0,-3,0)
  161. local MyParent = Boss
  162.  
  163. for i,v in pairs(Angles) do
  164. table.insert(MyAngles,i,{})
  165. MyAngles[i][1] = v[1]
  166. MyAngles[i][2] = v[2]
  167. MyAngles[i][3] = v[3]
  168. end
  169.  
  170. for i = 1,TStick do
  171. local Part = Instance.new("Part",MyParent)
  172. table.insert(Parts,i,Part)
  173. Part.FormFactor = "Custom"
  174. Part.CanCollide = false
  175. Part.Anchored = true
  176. Part.Size = Vector3.new(.1,.1,5)
  177. if OldPart == nil then
  178. Part.CFrame = MyCentre
  179. FirstPart = Part
  180. else
  181. Part.CFrame = OldPart.CFrame + OldPart.CFrame.lookVector*Part.Size.Z/2
  182. end
  183. OldPart = Part
  184. Part.CFrame = Part.CFrame + Part.CFrame.lookVector*Part.Size.Z/2
  185. end
  186.  
  187. local ReachMax=false
  188.  
  189. for i = 1, #Parts do
  190. table.insert(ModifyAngle,i,{0,0,0})
  191. end
  192.  
  193. local OldPos = Parts[#Parts].CFrame + Parts[#Parts].CFrame.lookVector*Parts[#Parts].Size.Z/2
  194.  
  195. local co = 0
  196. repeat
  197. local StopTry=false
  198. for i,v in pairs(ModifyAngle) do
  199. v[1] = v[1] + MyAngles[i][1]
  200. v[2] = v[2] + MyAngles[i][2]
  201. v[3] = v[3] + MyAngles[i][3]
  202.  
  203. if i == 1 then
  204. Parts[i].CFrame = MyCentre* CFrame.Angles(math.rad(v[1]),math.rad(v[2]),math.rad(v[3]))
  205. else
  206. Parts[i].CFrame = (Parts[i-1].CFrame + Parts[i-1].CFrame.lookVector*Parts[i-1].Size.Z/2)
  207. Parts[i].CFrame = Parts[i].CFrame * CFrame.Angles(math.rad(v[1]),math.rad(v[2]),math.rad(v[3]))
  208. end
  209. Parts[i].CFrame = Parts[i].CFrame + Parts[i].CFrame.lookVector*Parts[i].Size.Z/2
  210. local NewPos = Parts[#Parts].CFrame + Parts[#Parts].CFrame.lookVector*Parts[#Parts].Size.Z/2
  211.  
  212. local L,M = c:Part3(MyParent,{.1,.1,(NewPos.p - OldPos.p).magnitude})
  213. local R,G,B = HSVtoRGB(co%360,1,1)
  214. L.FormFactor = "Custom"
  215. L.TopSurface = "Smooth"
  216. L.BottomSurface = "Smooth"
  217. L.CanCollide = true
  218. L.Anchored = true
  219. L.CFrame = NewPos:lerp(OldPos,.3)
  220. L.CFrame = CFrame.new(NewPos.p,OldPos.p)
  221. L.CFrame = L.CFrame + L.CFrame.lookVector*((NewPos.p - OldPos.p).magnitude/2)
  222. M.VertexColor = Vector3.new(R,G,B)
  223.  
  224. OldPos = NewPos
  225.  
  226. if v[1]%360 == 0 and v[2]%360 == 0 and v[3]%360 == 0 and not StopTry then
  227. ReachMax = true
  228. elseif v[1]%360 ~= 0 or v[2]%360 ~= 0 or v[3]%360 ~= 0 then
  229. ReachMax = false
  230. StopTry = true
  231. end
  232. end
  233. wait()
  234. co=co+1
  235. until ReachMax
  236.  
  237. for i,v in pairs(Parts) do
  238. v:Destroy()
  239. end
  240. end
  241.  
  242. for i=1,7 do
  243. local Label = TextLabel(WS,UDim2.new(.1,0,.075,0),UDim2.new(.05,0,.05+(i-1)*0.085,0),WantedColor)
  244. Label.Text = "S"..i
  245. local X = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(1),WantedColor); X.BorderSizePixel = 0
  246. X.Changed:connect(function()
  247. Angles[i][1] = tonumber(X.Text)
  248. end)
  249. local Y = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(2.02),WantedColor); Y.BorderSizePixel = 0
  250. Y.Changed:connect(function()
  251. Angles[i][2] = tonumber(Y.Text)
  252. end)
  253. local Z = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(3.05),WantedColor); Z.BorderSizePixel = 0
  254. Z.Changed:connect(function()
  255. Angles[i][3] = tonumber(Z.Text)
  256. end)
  257. X.Text = Angles[i][1]; Y.Text = Angles[i][2]; Z.Text = Angles[i][3]
  258. if i > TStick then Label.Visible = false end
  259. table.insert(MStick,i,Label)
  260. end
  261.  
  262. local IncStick = TextButton(WS,UDim2.new(.055,0,.05,0),UDim2.new(.9,0,.05,0),WantedColor)
  263. IncStick.Text = "^"
  264. local DecStick = TextButton(WS,UDim2.new(.055,0,.049,0),UDim2.new(.9,0,.1,0),WantedColor)
  265. DecStick.Text = "v"
  266. local ShoStick = TextBox(WS,UDim2.new(.3,0,.1,0),UDim2.new(.6,0,.05,0),WantedColor)
  267. ShoStick.Text = TStick
  268.  
  269. IncStick.MouseButton1Click:connect(function()
  270. if TStick == 7 then return end
  271. TStick = TStick + 1
  272. ShoStick.Text = TStick
  273. reVisible(TStick)
  274. end)
  275. DecStick.MouseButton1Click:connect(function()
  276. if TStick == 1 then return end
  277. TStick = TStick - 1
  278. ShoStick.Text = TStick
  279. reVisible(TStick)
  280. end)
  281. ShoStick.Changed:connect(function()
  282. if tonumber(ShoStick.Text) < 1 then
  283. TStick = 1
  284. reVisible(TStick)
  285. elseif tonumber(ShoStick.Text) > 7 then
  286. TStick = 7
  287. reVisible(TStick)
  288. else
  289. ShoStick.Text = TStick
  290. end
  291. ShoStick.Text = TStick
  292. end)
  293.  
  294. local Generate = TextButton(WS,UDim2.new(0.8,0,0.2,0),UDim2.new(0.1,0,0.7,0),WantedColor); Generate.Text = "Generate"
  295. Generate.MouseButton1Click:connect(function()
  296. CreateGeometry()
  297. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement