Rufus14

Anti-Skid Starlight from R2DA

Aug 23rd, 2019 (edited)
1,770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.13 KB | None | 0 0
  1. --By Rufus14
  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. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. SpecialMesh2 = Instance.new("SpecialMesh")
  22. Part3 = Instance.new("Part")
  23. SpecialMesh4 = Instance.new("SpecialMesh")
  24. Part5 = Instance.new("Part")
  25. SpecialMesh6 = Instance.new("SpecialMesh")
  26. Weld7 = Instance.new("Weld")
  27. Weld8 = Instance.new("Weld")
  28. Sound9 = Instance.new("Sound")
  29. Sound10 = Instance.new("Sound")
  30. PointLight11 = Instance.new("PointLight")
  31. Script12 = Instance.new("Script")
  32. Tool0.Name = "Phial of Galadriel"
  33. Tool0.Parent = mas
  34. Part1.Name = "b"
  35. Part1.Parent = Tool0
  36. Part1.CFrame = CFrame.new(14.9249907, 0.900027037, 21.7563553, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  37. Part1.Orientation = Vector3.new(0, 90, 0)
  38. Part1.Position = Vector3.new(14.9249907, 0.900027037, 21.7563553)
  39. Part1.Rotation = Vector3.new(0, 90, 0)
  40. Part1.Color = Color3.new(0.972549, 0.972549, 0.972549)
  41. Part1.Size = Vector3.new(1.64770472, 0.250737697, 0.250737697)
  42. Part1.BottomSurface = Enum.SurfaceType.Smooth
  43. Part1.BrickColor = BrickColor.new("Institutional white")
  44. Part1.Material = Enum.Material.Neon
  45. Part1.TopSurface = Enum.SurfaceType.Smooth
  46. Part1.brickColor = BrickColor.new("Institutional white")
  47. SpecialMesh2.Parent = Part1
  48. SpecialMesh2.MeshType = Enum.MeshType.Cylinder
  49. Part3.Name = "a"
  50. Part3.Parent = Tool0
  51. Part3.CFrame = CFrame.new(14.9249907, 0.900026977, 21.1116028, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  52. Part3.Orientation = Vector3.new(0, 90, 0)
  53. Part3.Position = Vector3.new(14.9249907, 0.900026977, 21.1116028)
  54. Part3.Rotation = Vector3.new(0, 90, 0)
  55. Part3.Color = Color3.new(0.972549, 0.972549, 0.972549)
  56. Part3.Size = Vector3.new(0.21491766, 0.322377056, 0.322377056)
  57. Part3.BottomSurface = Enum.SurfaceType.Smooth
  58. Part3.BrickColor = BrickColor.new("Institutional white")
  59. Part3.Material = Enum.Material.Neon
  60. Part3.TopSurface = Enum.SurfaceType.Smooth
  61. Part3.brickColor = BrickColor.new("Institutional white")
  62. SpecialMesh4.Parent = Part3
  63. SpecialMesh4.MeshType = Enum.MeshType.Cylinder
  64. Part5.Name = "Handle"
  65. Part5.Parent = Tool0
  66. Part5.CFrame = CFrame.new(14.9249945, 0.875027001, 22.4011116, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  67. Part5.Orientation = Vector3.new(0, 90, 0)
  68. Part5.Position = Vector3.new(14.9249945, 0.875027001, 22.4011116)
  69. Part5.Rotation = Vector3.new(0, 90, 0)
  70. Part5.Color = Color3.new(0.972549, 0.972549, 0.972549)
  71. Part5.Size = Vector3.new(1.43278694, 0.866393507, 0.816393495)
  72. Part5.BottomSurface = Enum.SurfaceType.Smooth
  73. Part5.BrickColor = BrickColor.new("Institutional white")
  74. Part5.Material = Enum.Material.Neon
  75. Part5.TopSurface = Enum.SurfaceType.Smooth
  76. Part5.brickColor = BrickColor.new("Institutional white")
  77. SpecialMesh6.Parent = Part5
  78. SpecialMesh6.MeshType = Enum.MeshType.Sphere
  79. Weld7.Parent = Part5
  80. Weld7.C0 = CFrame.new(1.28950882, 0.0249999762, -3.81469727e-06, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  81. Weld7.Part0 = Part5
  82. Weld7.Part1 = Part3
  83. Weld7.part1 = Part3
  84. Weld8.Parent = Part5
  85. Weld8.C0 = CFrame.new(0.644756317, 0.025000006, -3.81469727e-06, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  86. Weld8.Part0 = Part5
  87. Weld8.Part1 = Part1
  88. Weld8.part1 = Part1
  89. Sound9.Name = "Use"
  90. Sound9.Parent = Part5
  91. Sound9.Looped = true
  92. Sound9.EmitterSize = 50
  93. Sound9.MinDistance = 50
  94. Sound9.SoundId = "rbxassetid://596782957"
  95. Sound9.Volume = 1
  96. Sound10.Name = "Breaksound"
  97. Sound10.Parent = Part5
  98. Sound10.Pitch = 0.80000001192093
  99. Sound10.PlayOnRemove = true
  100. Sound10.PlaybackSpeed = 0.80000001192093
  101. Sound10.SoundId = "rbxassetid://156444949"
  102. Sound10.Volume = 1
  103. PointLight11.Parent = Part5
  104. PointLight11.Range = 15
  105. PointLight11.Brightness = 1.5
  106. Script12.Name = "Starlight"
  107. Script12.Parent = Tool0
  108. table.insert(cors,sandbox(Script12,function()
  109. --By Rufus14
  110. --[[
  111.     What it does:
  112.     -It repels npc's with "Zombie" in their name
  113.     -characters have to be in workspace to make repel function work
  114. ]]--
  115. tool = script.Parent
  116. owner = nil
  117. handle = tool.Handle
  118. usesound = handle.Use
  119. breaksound = handle.Breaksound
  120. step = game:GetService("RunService").Stepped
  121. tookon = false
  122. sine = 0
  123. usemeter = 1300
  124. function equipped()
  125.     tookon = true
  126.     if usemeter ~= 0 then
  127.         usesound:Play()
  128.     end
  129.     owner = tool.Parent
  130.     if owner:findFirstChild("Torso") then
  131.         local toolweld = owner["Right Arm"]:WaitForChild("RightGrip")
  132.         toolweld.C0 = toolweld.C0 * CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.6,0,0)
  133.         if owner:findFirstChild("Left Arm") then
  134.             local leftarm = Instance.new("Weld", owner.Torso)
  135.             leftarm.Part0 = owner.Torso
  136.             leftarm.Part1 = owner["Left Arm"]
  137.             leftarm.C0 = CFrame.new(-1.5,0.5,0)
  138.             leftarm.C1 = CFrame.new(0,0.5,0)
  139.             leftarm.Name = "LeftArmWeldd"
  140.         end
  141.         if owner:findFirstChild("Right Arm") then
  142.             local rightarm = Instance.new("Weld", owner.Torso)
  143.             rightarm.Part0 = owner.Torso
  144.             rightarm.Part1 = owner["Right Arm"]
  145.             rightarm.C0 = CFrame.new(1.5,0.5,0)
  146.             rightarm.C1 = CFrame.new(0,0.5,0)
  147.             rightarm.Name = "RightArmWeldd"
  148.         end
  149.         local head = Instance.new("Weld", owner.Torso)
  150.         head.Part0 = owner.Torso
  151.         head.Part1 = owner.Head
  152.         head.C0 = CFrame.new(0,1,0)
  153.         head.C1 = CFrame.new(0,-0.5,0)
  154.         head.Name = "HeadWeldd"
  155.         local function animate()
  156.             while tookon and step:wait() do
  157.                 sine = sine - 1
  158.                 head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(5)+math.rad(2*math.sin(sine/50)),-math.rad(10)+math.rad(3*math.cos(sine/50)),0),0.15)
  159.                 if owner.Torso:findFirstChild("LeftArmWeldd") then
  160.                     owner.Torso:findFirstChild("LeftArmWeldd").C0 = owner.Torso:findFirstChild("LeftArmWeldd").C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,0,math.rad(-10)+math.rad(3*math.cos(sine/50))),0.15)
  161.                 end
  162.                 if owner.Torso:findFirstChild("RightArmWeldd") then
  163.                     owner.Torso:findFirstChild("RightArmWeldd").C0 = owner.Torso:findFirstChild("RightArmWeldd").C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles((math.pi)-math.rad(15)+math.rad(3*math.sin(sine/50)),0,0),0.15)
  164.                 end
  165.             end
  166.         end
  167.         spawn(animate)
  168.         while tookon and usemeter ~= 0 do
  169.             usemeter = usemeter - 1
  170.             if usemeter == 0 then
  171.                 tool.Parent = workspace
  172.                 if handle:findFirstChildOfClass("PointLight") then
  173.                     breaksound:Play()
  174.                     handle.Transparency = 0.6
  175.                     if tool:findFirstChild("a") then
  176.                         tool.a.Transparency = 0.6
  177.                     end
  178.                     if tool:findFirstChild("b") then
  179.                         tool.b.Transparency = 0.6
  180.                     end
  181.                     handle:findFirstChildOfClass("PointLight"):destroy()
  182.                 end
  183.             end
  184.             for i,v in pairs(workspace:GetChildren()) do
  185.                 if v.ClassName == "Model" and v ~= owner then
  186.                     local zombiehumanoid = v:findFirstChildOfClass("Humanoid")
  187.                     local zombiehead = v:findFirstChild("Head")
  188.                     if zombiehumanoid and zombiehead then
  189.                         if (zombiehead.Position - handle.Position).magnitude <= 30 then
  190.                             if string.find(string.lower(v.Name),"zombie",1) or string.find(string.lower(v.Name),"demon",1) or string.find(string.lower(v.Name),"satan",1) or string.find(string.lower(v.Name),"skeleton",1) or string.find(string.lower(v.Name),"furry",1) or string.find(string.lower(v.Name),"latex",1) or string.find(string.lower(zombiehumanoid .DisplayName),"latex",1) then
  191.                                 walkaway(v, zombiehead, zombiehumanoid)
  192.                             elseif zombiehumanoid.Name == string.find(string.lower(v.Name),"zombie",1) then --check if humanoid is named zombie
  193.                                 walkaway(v, zombiehead, zombiehumanoid)
  194.                             elseif zombiehead:findFirstChild("c-cat_noises") then --anti grey cat script
  195.                                 walkaway(v, zombiehead, zombiehumanoid)
  196.                             elseif v:findFirstChildOfClass("Sound") then
  197.                                 if v:findFirstChildOfClass("Sound").SoundId == "rbxassetid://614032233" or v:findFirstChildOfClass("Sound").SoundId == "rbxassetid://415898123" or v:findFirstChildOfClass("Sound").Name == "wrecked" then
  198.                                     walkaway(v, zombiehead, zombiehumanoid)
  199.                                 end
  200.                             elseif v:findFirstChild("_status") then
  201.                                 if v["_status"]:findFirstChildOfClass("TextLabel") then
  202.                                     walkaway(v, zombiehead, zombiehumanoid)
  203.                                 end
  204.                             end
  205.                         end
  206.                     end
  207.                 end
  208.             end
  209.             step:wait()
  210.         end
  211.     end
  212. end
  213. function walkaway(zombie, hed, humanoidzombie)
  214.     if not zombie:findFirstChild("okbroimgoing") then
  215.         local okimgoing = Instance.new("BoolValue", zombie)
  216.         okimgoing.Name = "okbroimgoing"
  217.         local function makeapath()
  218.             local function pathspawn()
  219.                 local randompart = Instance.new("Part", workspace)
  220.                 randompart.CFrame = CFrame.new(hed.Position, handle.Position)
  221.                 randompart.Anchored = true
  222.                 randompart.CanCollide = false
  223.                 randompart.Transparency = 1
  224.                 randompart.CFrame = randompart.CFrame * CFrame.new(math.random(-30,30),math.random(-30,30),math.random(10,30))
  225.                 humanoidzombie.WalkToPoint = randompart.Position
  226.                 local path = game:GetService("PathfindingService"):FindPathAsync(hed.Position, randompart.Position)
  227.                 local points = path:GetWaypoints()
  228.                 randompart:destroy()
  229.                 local threshold = 0
  230.                 if path.Status == Enum.PathStatus.Success then
  231.                     local chance = 2
  232.                     humanoidzombie.WalkSpeed = 30
  233.                     local function run()
  234.                         wait(0.5)
  235.                         humanoidzombie.WalkSpeed = 16
  236.                     end
  237.                     spawn(run)
  238.                     for q,w in pairs(points) do
  239.                         threshold = 0
  240.                         while (hed.Position - w.Position).magnitude >= 5.5 and threshold <= 39 and chance ~= 0 do
  241.                             humanoidzombie.WalkToPoint = w.Position
  242.                             threshold = threshold + 1
  243.                             if threshold >= 40 then
  244.                                 chance = chance - 1
  245.                                 break
  246.                             end
  247.                             if w.Action == Enum.PathWaypointAction.Jump then
  248.                                 humanoidzombie.Jump = true
  249.                             end
  250.                             step:wait()
  251.                         end
  252.                     end
  253.                     okimgoing:destroy()
  254.                 else
  255.                     makeapath()
  256.                 end
  257.             end
  258.             spawn(pathspawn)
  259.         end
  260.         makeapath()
  261.     end
  262. end
  263. function unequipped()
  264.     tookon = false
  265.     usesound:Stop()
  266.     if owner:findFirstChild("Torso") then
  267.         for i = 0,1 , 0.04 do
  268.             if owner.Torso:findFirstChild("HeadWeldd") then
  269.                 owner.Torso:findFirstChild("HeadWeldd").C0 = owner.Torso:findFirstChild("HeadWeldd").C0:lerp(CFrame.new(0,1,0),0.15)
  270.             end
  271.             if owner.Torso:findFirstChild("LeftArmWeldd") then
  272.                 owner.Torso:findFirstChild("LeftArmWeldd").C0 = owner.Torso:findFirstChild("LeftArmWeldd").C0:lerp(CFrame.new(-1.5,0.5,0),0.15)
  273.             end
  274.             if owner.Torso:findFirstChild("RightArmWeldd") then
  275.                 owner.Torso:findFirstChild("RightArmWeldd").C0 = owner.Torso:findFirstChild("RightArmWeldd").C0:lerp(CFrame.new(1.5,0.5,0),0.15)
  276.             end
  277.             step:wait()
  278.         end
  279.         if owner.Torso:findFirstChild("RightArmWeldd") then
  280.             owner.Torso:findFirstChild("RightArmWeldd"):destroy()
  281.         end
  282.         if owner.Torso:findFirstChild("LeftArmWeldd") then
  283.             owner.Torso:findFirstChild("LeftArmWeldd"):destroy()
  284.         end
  285.         if owner.Torso:findFirstChild("HeadWeldd") then
  286.             owner.Torso:findFirstChild("HeadWeldd"):destroy()
  287.         end
  288.     end
  289. end
  290. tool.Equipped:connect(equipped)
  291. tool.Unequipped:connect(unequipped)
  292. end))
  293. for i,v in pairs(mas:GetChildren()) do
  294.     v.Parent = owner.Character
  295.     pcall(function() v:MakeJoints() end)
  296. end
  297. mas:Destroy()
  298. for i,v in pairs(cors) do
  299.     spawn(function()
  300.         pcall(v)
  301.     end)
  302. end
Add Comment
Please, Sign In to add comment