Advertisement
firebudgy

Untitled

Jan 23rd, 2018
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Script1 = Instance.new("Script")
  21. Part2 = Instance.new("Part")
  22. Part3 = Instance.new("Part")
  23. Part4 = Instance.new("Part")
  24. Part5 = Instance.new("Part")
  25. Part6 = Instance.new("Part")
  26. Part7 = Instance.new("Part")
  27. Part8 = Instance.new("Part")
  28. Part9 = Instance.new("Part")
  29. Script10 = Instance.new("Script")
  30. Model0.Name = "Sonic Slime"
  31. Model0.Parent = mas
  32. Script1.Parent = Model0
  33. table.insert(cors,sandbox(Script1,function()
  34. --Particle Slime by timwood1104--
  35. -- Particle Slime is an interesting concept of Roblox enemy completely designed and built by
  36. -- timwood1104(aka, me). Originally inspired by an episode from Star Treck, I designed this using the
  37. -- .magnitude as a way to determine which slime particle is closest and farthest away from the target.
  38. -- To move closer to the target, the slime takes the particle farthest away and puts it in a random
  39. -- position closer to the target it is chasing. This causes the slime to move slowly, but surely towards it's
  40. -- prey. Obviously, the slime has no Humanoid, meaning that it can't be killed unless somebody
  41. -- constructs a specific tool to do so. Remember, I made this first! Enjoy :P
  42.  
  43. -------------
  44. spaces = 2 -- How many spaces it travels per move(1-3 is the best, preferably 2)
  45. speed = 30 -- How fast it goes, just put any number I guess :P
  46. grabslime = true -- Whether the slime will grab Slimeys from Workspace or not; it doesn't affect much
  47. ------------- though. Basically, if there is any bricks in Workspace named "Slimey", it will add them to itself.
  48.  
  49.  
  50. function findTarget() -- Ah, the findTarget() command. This command lets the slime find it's next victem.
  51. g = game.Workspace:getChildren()
  52. for i=1, #g do
  53. if g[i]:findFirstChild("Torso") ~= nil then
  54. if T == nil then
  55. T = g[i].Torso
  56. else
  57. if (g[i].Torso.Position - script.Parent.Slimey.Position).magnitude < (T.Position - script.Parent.Slimey.Position).magnitude then
  58. T = g[i].Torso
  59. end
  60. end
  61. end
  62. if grabslime == true and g[i].Name == "Slimey" and g[i].className == "Part" and g[i].Size == Vector3.new(1,1,1) then
  63. g[i].Parent = script.Parent
  64. end
  65. end
  66. end
  67.  
  68. function fade(b)-- This lets a brick disappear by "fading" into invisibility, but you can't see the effect very
  69. while b.Transparency < 1 do-- easily unless the slime is at a slow speed.
  70. b.Transparency = b.Transparency + 0.01*speed*#p/4
  71. wait(0.001)
  72. end
  73. b.Transparency = 1
  74. end
  75.  
  76. function unfade(b) -- This lets a brick appear by "fading" into visibility, but you can't see the effect very
  77. while b.Transparency > 0 do -- easily unless the slime is at a slow speed.
  78. b.Transparency = b.Transparency - 0.01*speed*#p/4
  79. wait(0.001)
  80. end
  81. b.Transparency = 0
  82. end
  83.  
  84. while true do
  85.  
  86. T = nil -- Erases previous target from memory.
  87. findTarget() -- Finds the new closest target!
  88.  
  89. r = math.random(1,20) --This little bit is supposed to allow the slime to take bigger "steps" every
  90. if r == 1 or r == 2 or r == 3 then -- once and a while, thus allowing it to travel through thick walls.
  91. space = spaces + 1
  92. elseif r == 4 or r == 5 then
  93. space = spaces + 2
  94. elseif r == 6 then
  95. space = spaces + 3
  96. else
  97. space = spaces
  98. end
  99.  
  100. if T ~= nil then --If target exists, then attack!
  101. p = script.Parent:getChildren() -- Makes a list of the slime's "Slimeys"
  102. for i=1, #p do
  103. if p[i].Name == "Slimey" then
  104. if prev == nil then
  105. prev = p[i]
  106. prev2 = p[i]
  107. end
  108. if (p[i].Position - T.Position).magnitude > (prev.Position - T.Position).magnitude then
  109. prev = p[i] -- This finds the Slimey closest to the target.
  110. end
  111. if (p[i].Position - T.Position).magnitude < (prev2.Position - T.Position).magnitude then
  112. prev2 = p[i] -- This finds the Slimey farthest away from the target.
  113. end
  114. end
  115. end
  116. fade(prev) --Make Slimey dissappear. VV- Make Slimey move closer to target.
  117. prev.Position = Vector3.new(prev2.Position.x+math.random(-space,space), prev2.Position.y-1, prev2.Position.z+math.random(-space,space))
  118. unfade(prev) -- Make Slimey appear again.
  119. end
  120. wait(0.01) -- And then wait... :P
  121. end -- Repeat!!
  122.  
  123.  
  124. end))
  125. Part2.Name = "Slimey"
  126. Part2.Parent = Model0
  127. Part2.BrickColor = BrickColor.new("Navy blue")
  128. Part2.Anchored = true
  129. Part2.Locked = true
  130. Part2.FormFactor = Enum.FormFactor.Symmetric
  131. Part2.Size = Vector3.new(1, 1, 1)
  132. Part2.CFrame = CFrame.new(-26.5, 0.50001502, -11.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  133. Part2.BackSurface = Enum.SurfaceType.Glue
  134. Part2.BottomSurface = Enum.SurfaceType.Glue
  135. Part2.FrontSurface = Enum.SurfaceType.Glue
  136. Part2.LeftSurface = Enum.SurfaceType.Glue
  137. Part2.RightSurface = Enum.SurfaceType.Glue
  138. Part2.TopSurface = Enum.SurfaceType.Glue
  139. Part2.Color = Color3.new(0, 0.12549, 0.376471)
  140. Part2.Position = Vector3.new(-26.5, 0.50001502, -11.5)
  141. Part2.Color = Color3.new(0, 0.12549, 0.376471)
  142. Part3.Name = "Slimey"
  143. Part3.Parent = Model0
  144. Part3.BrickColor = BrickColor.new("Navy blue")
  145. Part3.Anchored = true
  146. Part3.Locked = true
  147. Part3.FormFactor = Enum.FormFactor.Symmetric
  148. Part3.Size = Vector3.new(1, 1, 1)
  149. Part3.CFrame = CFrame.new(-26.5, 0.50001502, -10.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  150. Part3.BackSurface = Enum.SurfaceType.Glue
  151. Part3.BottomSurface = Enum.SurfaceType.Glue
  152. Part3.FrontSurface = Enum.SurfaceType.Glue
  153. Part3.LeftSurface = Enum.SurfaceType.Glue
  154. Part3.RightSurface = Enum.SurfaceType.Glue
  155. Part3.TopSurface = Enum.SurfaceType.Glue
  156. Part3.Color = Color3.new(0, 0.12549, 0.376471)
  157. Part3.Position = Vector3.new(-26.5, 0.50001502, -10.5)
  158. Part3.Color = Color3.new(0, 0.12549, 0.376471)
  159. Part4.Name = "Slimey"
  160. Part4.Parent = Model0
  161. Part4.BrickColor = BrickColor.new("Navy blue")
  162. Part4.Anchored = true
  163. Part4.Locked = true
  164. Part4.FormFactor = Enum.FormFactor.Symmetric
  165. Part4.Size = Vector3.new(1, 1, 1)
  166. Part4.CFrame = CFrame.new(-26.5, 1.50001395, -11.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  167. Part4.BackSurface = Enum.SurfaceType.Glue
  168. Part4.BottomSurface = Enum.SurfaceType.Glue
  169. Part4.FrontSurface = Enum.SurfaceType.Glue
  170. Part4.LeftSurface = Enum.SurfaceType.Glue
  171. Part4.RightSurface = Enum.SurfaceType.Glue
  172. Part4.TopSurface = Enum.SurfaceType.Glue
  173. Part4.Color = Color3.new(0, 0.12549, 0.376471)
  174. Part4.Position = Vector3.new(-26.5, 1.50001395, -11.5)
  175. Part4.Color = Color3.new(0, 0.12549, 0.376471)
  176. Part5.Name = "Slimey"
  177. Part5.Parent = Model0
  178. Part5.BrickColor = BrickColor.new("Navy blue")
  179. Part5.Anchored = true
  180. Part5.Locked = true
  181. Part5.FormFactor = Enum.FormFactor.Symmetric
  182. Part5.Size = Vector3.new(1, 1, 1)
  183. Part5.CFrame = CFrame.new(-26.5, 1.50001395, -10.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  184. Part5.BackSurface = Enum.SurfaceType.Glue
  185. Part5.BottomSurface = Enum.SurfaceType.Glue
  186. Part5.FrontSurface = Enum.SurfaceType.Glue
  187. Part5.LeftSurface = Enum.SurfaceType.Glue
  188. Part5.RightSurface = Enum.SurfaceType.Glue
  189. Part5.TopSurface = Enum.SurfaceType.Glue
  190. Part5.Color = Color3.new(0, 0.12549, 0.376471)
  191. Part5.Position = Vector3.new(-26.5, 1.50001395, -10.5)
  192. Part5.Color = Color3.new(0, 0.12549, 0.376471)
  193. Part6.Name = "Slimey"
  194. Part6.Parent = Model0
  195. Part6.BrickColor = BrickColor.new("Navy blue")
  196. Part6.Anchored = true
  197. Part6.Locked = true
  198. Part6.FormFactor = Enum.FormFactor.Symmetric
  199. Part6.Size = Vector3.new(1, 1, 1)
  200. Part6.CFrame = CFrame.new(-25.5, 0.50001502, -10.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  201. Part6.BackSurface = Enum.SurfaceType.Glue
  202. Part6.BottomSurface = Enum.SurfaceType.Glue
  203. Part6.FrontSurface = Enum.SurfaceType.Glue
  204. Part6.LeftSurface = Enum.SurfaceType.Glue
  205. Part6.RightSurface = Enum.SurfaceType.Glue
  206. Part6.TopSurface = Enum.SurfaceType.Glue
  207. Part6.Color = Color3.new(0, 0.12549, 0.376471)
  208. Part6.Position = Vector3.new(-25.5, 0.50001502, -10.5)
  209. Part6.Color = Color3.new(0, 0.12549, 0.376471)
  210. Part7.Name = "Slimey"
  211. Part7.Parent = Model0
  212. Part7.BrickColor = BrickColor.new("Navy blue")
  213. Part7.Anchored = true
  214. Part7.Locked = true
  215. Part7.FormFactor = Enum.FormFactor.Symmetric
  216. Part7.Size = Vector3.new(1, 1, 1)
  217. Part7.CFrame = CFrame.new(-25.5, 1.50001395, -10.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  218. Part7.BackSurface = Enum.SurfaceType.Glue
  219. Part7.BottomSurface = Enum.SurfaceType.Glue
  220. Part7.FrontSurface = Enum.SurfaceType.Glue
  221. Part7.LeftSurface = Enum.SurfaceType.Glue
  222. Part7.RightSurface = Enum.SurfaceType.Glue
  223. Part7.TopSurface = Enum.SurfaceType.Glue
  224. Part7.Color = Color3.new(0, 0.12549, 0.376471)
  225. Part7.Position = Vector3.new(-25.5, 1.50001395, -10.5)
  226. Part7.Color = Color3.new(0, 0.12549, 0.376471)
  227. Part8.Name = "Slimey"
  228. Part8.Parent = Model0
  229. Part8.BrickColor = BrickColor.new("Navy blue")
  230. Part8.Anchored = true
  231. Part8.Locked = true
  232. Part8.FormFactor = Enum.FormFactor.Symmetric
  233. Part8.Size = Vector3.new(1, 1, 1)
  234. Part8.CFrame = CFrame.new(-25.5, 1.50001395, -11.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  235. Part8.BackSurface = Enum.SurfaceType.Glue
  236. Part8.BottomSurface = Enum.SurfaceType.Glue
  237. Part8.FrontSurface = Enum.SurfaceType.Glue
  238. Part8.LeftSurface = Enum.SurfaceType.Glue
  239. Part8.RightSurface = Enum.SurfaceType.Glue
  240. Part8.TopSurface = Enum.SurfaceType.Glue
  241. Part8.Color = Color3.new(0, 0.12549, 0.376471)
  242. Part8.Position = Vector3.new(-25.5, 1.50001395, -11.5)
  243. Part8.Color = Color3.new(0, 0.12549, 0.376471)
  244. Part9.Name = "Slimey"
  245. Part9.Parent = Model0
  246. Part9.BrickColor = BrickColor.new("Navy blue")
  247. Part9.Anchored = true
  248. Part9.Locked = true
  249. Part9.FormFactor = Enum.FormFactor.Symmetric
  250. Part9.Size = Vector3.new(1, 1, 1)
  251. Part9.CFrame = CFrame.new(-25.5, 0.50001502, -11.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  252. Part9.BackSurface = Enum.SurfaceType.Glue
  253. Part9.BottomSurface = Enum.SurfaceType.Glue
  254. Part9.FrontSurface = Enum.SurfaceType.Glue
  255. Part9.LeftSurface = Enum.SurfaceType.Glue
  256. Part9.RightSurface = Enum.SurfaceType.Glue
  257. Part9.TopSurface = Enum.SurfaceType.Glue
  258. Part9.Color = Color3.new(0, 0.12549, 0.376471)
  259. Part9.Position = Vector3.new(-25.5, 0.50001502, -11.5)
  260. Part9.Color = Color3.new(0, 0.12549, 0.376471)
  261. Script10.Name = "Touch"
  262. Script10.Parent = Model0
  263. table.insert(cors,sandbox(Script10,function()
  264. ting = false
  265. function onTouched(p)
  266. if ting == false then
  267. ting = true
  268. if p.Name == "Left Arm" or p.Name == "Right Arm" or p.Name == "Left Leg" or p.Name == "Right Leg" or p.Name == "Head" or p.Name == "Torso" or p.Name == "zarm" then
  269. p.Anchored = true
  270. reflect(p)
  271. part = Instance.new("Part")
  272. part.Parent = game.Workspace
  273. part.Position = p.Position
  274. p:remove()
  275. part.Reflectance = 1
  276. part.formFactor = "Symmetric"
  277. part.TopSurface = "Glue"
  278. part.BottomSurface = "Glue"
  279. part.LeftSurface = "Glue"
  280. part.RightSurface = "Glue"
  281. part.BackSurface = "Glue"
  282. part.FrontSurface = "Glue"
  283. part.Locked = true
  284. part.Anchored = true
  285. part.Size = Vector3.new(1,1,1)
  286. unreflect(part)
  287. part.BrickColor = script.Parent.Slimey.BrickColor
  288. part.Parent = script.Parent
  289. part.Name = "Slimey"
  290. part.Touched:connect(onTouched)
  291. end
  292. ting = false
  293. end
  294. end
  295.  
  296. function reflect(b)
  297. while b.Reflectance < 1 do
  298. b.Reflectance = b.Reflectance + 0.05
  299. wait(0.01)
  300. end
  301. b.Reflectance = 1
  302. end
  303.  
  304. function unreflect(b)
  305. while b.Reflectance > 0 do
  306. b.Reflectance = b.Reflectance - 0.05
  307. wait(0.01)
  308. end
  309. b.Reflectance = 0
  310. end
  311.  
  312. e = script.Parent:getChildren()
  313. for i=1, #e do
  314. if e[i].Name == "Slimey" then
  315. e[i].Touched:connect(onTouched)
  316. end
  317. end
  318.  
  319. end))
  320. for i,v in pairs(mas:GetChildren()) do
  321. v.Parent = workspace
  322. pcall(function() v:MakeJoints() end)
  323. end
  324. mas:Destroy()
  325. for i,v in pairs(cors) do
  326. spawn(function()
  327. pcall(v)
  328. end)
  329. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement