Advertisement
PotatoSaiyan

Block Visualizer

Mar 8th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. --- Color doesnt work properly
  2. local plr = game.Players.LocalPlayer
  3. local char = plr.Character
  4. local torso = char:FindFirstChild('Torso')
  5. local hrp = char.HumanoidRootPart
  6. local color = false
  7. local color2 = false
  8. local Power = 300
  9. local Render = 1
  10. local m=Instance.new('Model',char)
  11.  
  12. function noOutline(part)
  13. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  14. end
  15.  
  16. for angle = 1,360,3 do
  17. local p = Instance.new('Part',m)
  18. local p2=Instance.new('PointLight',p)
  19. local col=math.random(200,255)
  20. if angle==1 then
  21. m.PrimaryPart = p
  22. end
  23. noOutline(p)
  24. p.Material='Neon'
  25. p.BrickColor = BrickColor.new('Light blue')
  26. p.Name = 'P'
  27. p.Size = Vector3.new(.5,.5,.5)
  28. p.Anchored = true
  29. p.CanCollide = false
  30. p.CFrame = torso.CFrame*CFrame.Angles(0,math.rad(angle),0)*CFrame.new(0,0,5)
  31. p.Locked =true
  32. end
  33.  
  34. rad = 11
  35. circ = 2*math.pi*rad
  36. n = circ/(rad/10)
  37. rot = 360/n
  38.  
  39. x = 1
  40. y = 1
  41. z = 1
  42. xinc = 1
  43. yinc = 1.5
  44. zinc = -2
  45.  
  46. function Sound(remove,name,parent,loop,vol,id)
  47. if remove == false then
  48. local s = Instance.new('Sound',parent)
  49. s.Name = name
  50. s.Looped = loop
  51. s.Volume = vol
  52. s.SoundId = 'rbxassetid://'..tostring(id)
  53. s.MaxDistance = 50
  54. s.EmitterSize = 25
  55. s:Play()
  56. if loop == false then
  57. wait(s.TimeLength)
  58. s:Destroy()
  59. end
  60. return s
  61. else
  62. parent[name]:Destroy()
  63. end
  64. end
  65.  
  66. local Music = Sound(false,'Music',hrp,true,1,0)
  67.  
  68. local colors = {
  69. Color3.fromRGB(52, 152, 219),
  70. Color3.fromRGB(46, 204, 113),
  71. Color3.fromRGB(26, 188, 156),
  72. Color3.fromRGB(155, 89, 182),
  73. Color3.fromRGB(241, 196, 15),
  74. Color3.fromRGB(230, 196, 34),
  75. Color3.fromRGB(192, 57, 43),
  76. Color3.fromRGB(189, 195, 199),
  77. Color3.fromRGB(52, 73, 94),
  78. Color3.fromRGB(41, 128, 185),
  79. Color3.fromRGB(142, 68, 173),
  80. Color3.fromRGB(39, 174, 96),
  81. Color3.fromRGB(22, 160, 133),
  82. Color3.fromRGB(243, 156, 18),
  83. Color3.fromRGB(211, 84, 0),
  84. Color3.fromRGB(192, 57, 43),
  85. }
  86.  
  87. function colorchange()
  88. if color==true then
  89. col=brickcolors[math.random(1,#colors)]
  90. for i,v in pairs(m:GetChildren()) do
  91. v.BrickColor=BrickColor.new(col)
  92. v.PointLight.Color=col
  93. end
  94. elseif color==false then
  95. for i,v in pairs(m:GetChildren()) do
  96. v.BrickColor=BrickColor.new('Light blue')
  97. v.PointLight.Color=Color3.fromRGB(255,255,255)
  98. end
  99. end
  100. end
  101.  
  102. function rotation()
  103. while game:getService'RunService'.RenderStepped:wait(Render) do
  104. if hrp ~= nil and torso ~= nil then
  105. colorchange()
  106. x = x+xinc
  107. y = y+yinc
  108. z = z-zinc
  109. m:SetPrimaryPartCFrame(m.PrimaryPart.CFrame:Lerp(torso.CFrame*CFrame.Angles(math.rad(x),math.rad(y),math.rad(z))*CFrame.new(0,0,(Music.PlaybackLoudness/25)/2),.5))
  110. for i,v in pairs(m:GetChildren()) do
  111. v.CFrame=v.CFrame:Lerp(torso.CFrame*CFrame.Angles(math.rad(x)+(-math.sin(i*(Music.PlaybackLoudness/Power))),math.rad(y)+(-math.sin(i*(Music.PlaybackLoudness/Power))),math.rad(z))*CFrame.new(0,0,(Music.PlaybackLoudness/25)),.5)
  112. end
  113. end
  114. end
  115. end
  116. spawn(rotation)
  117.  
  118. function Chatted(msg,Plr)
  119. if msg:sub(1,6):match('$play ') then
  120. local s=hrp.Music
  121. s.SoundId='rbxassetid://'..msg:sub(7)
  122. s:Play()
  123. elseif msg:sub(1,7):match('$color ') then
  124. if msg:len()>=8 and color==false and color2==false then
  125. for i,v in pairs(m:GetChildren()) do
  126. v.BrickColor=BrickColor.new(msg:sub(8))
  127. end
  128. elseif msg:len()<8 then
  129. if color==false then
  130. color=true
  131. color2=true
  132. else
  133. color=false
  134. color2=false
  135. end
  136. end
  137. elseif msg:sub(1,10):match('$material ') then
  138. for i,v in pairs(m:GetChildren()) do
  139. v.Material=msg:sub(11)
  140. end
  141. elseif msg:sub(1,7):match('$power ') then
  142. Power = tonumber(msg:sub(8))
  143. elseif msg:sub(1,8):match('$render ') then
  144. Render = tonumber(msg:sub(9))
  145. elseif msg:sub(1,5):match('$vol ') then
  146. Volume = tonumber(msg:sub(6))
  147. elseif msg:sub(1,6):match('$pause') then
  148. local s=hrp.Music
  149. s:Pause()
  150. elseif msg:sub(1,7):match('$resume') then
  151. local s=hrp.Music
  152. s:Resume()
  153. elseif msg:sub(1,6):match('$tpos ') then
  154. local s=hrp.Music
  155. s.TimePosition=tonumber(msg:sub(7))
  156. elseif msg:sub(1,8):match('$maxdis ') then
  157. Distance=tonumber(msg:sub(9))
  158. elseif msg:sub(1,6):match('$emit ') then
  159. Emit=tonumber(msg:sub(7))
  160. end
  161. end
  162.  
  163. plr.Chatted:connect(function(msg) Chatted(msg,plr) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement