hawoody

Rainbow string creator

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