Advertisement
DropSquad

Midas Touch (Local SB)

Aug 24th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. -- MIDAS TOUCH --
  2.  
  3. local Player = game.Players.LocalPlayer;
  4. local Character = Player.Character;
  5. local CharacterAdded = Player.CharacterAdded:connect(function(NewCharacter)
  6.     Character = NewCharacter;
  7. end)
  8.  
  9. function doPath(Position)
  10.     local Base = CFrame.new(Position) + Vector3.new(10 * math.random(), 10 * math.random(), 10 * math.random())
  11.     local Part = Instance.new("Part", Character);
  12.     Part.Name = "GoldPath";
  13.     Part.BrickColor = BrickColor.new("Cool yellow");
  14.     Part.Material = Enum.Material.SmoothPlastic;
  15.     Part.Reflectance = 0.5;
  16.     Part.Transparency = 1;
  17.     Part.Anchored = true;
  18.     Part.CanCollide = false;
  19.     Part.Locked = true;
  20.     Part.FormFactor = Enum.FormFactor.Custom;
  21.     Part.Size = Vector3.new(3, 0.2, 3);
  22.     Part.CFrame = CFrame.new(Position);
  23.     Instance.new("CylinderMesh", Part);
  24.    
  25.     spawn(function()
  26.         local Base = Base * CFrame.Angles(math.random(), math.random(), math.random())
  27.         for Alpha = 0, 1, 0.1 do
  28.             wait();
  29.             Part.Transparency = 1 - Alpha;
  30.             Part.CFrame = Base:lerp(CFrame.new(Position), Alpha ^ 2);
  31.         end
  32.         Part.CanCollide = true;
  33.         game.Debris:AddItem(Part, 2.5)
  34.     end)
  35. end
  36.  
  37. while true do
  38.     wait();
  39.     local Head = Character and Character:FindFirstChild("Head");
  40.     local Torso = Character and Character:FindFirstChild("Torso") and Character.Torso;
  41.     if Head then
  42.         Position = Head.Position;
  43.         local Ray = Ray.new(Position, Vector3.new(0, -1e3, 0));
  44.         local Hit, _, Surface = workspace:FindPartOnRay(Ray, Character);
  45.         if Hit and Torso and math.floor(Torso.Velocity.magnitude) > 0 then
  46.             local Surface = Vector3.new(Position.X, Hit.Position.Y + Hit.Size.Y/2, Position.Z);
  47.             if (Surface - Position).magnitude < 5 then
  48.                 doPath(Surface);
  49.             end
  50.         end
  51.         local Offset = Vector3.new(-2, -5, -2);
  52.         local P0 = Position + Offset;
  53.         local P1 = Position - Offset;
  54.         local Region = Region3.new(P0, P1);
  55.         local Parts = workspace:FindPartsInRegion3(Region, Character, 100);
  56.         for _, Part in next, Parts do
  57.             local Size = Part.Size;
  58.             if Size.magnitude < (Offset * -2).magnitude then
  59.                 Part.BrickColor = BrickColor.new("Cool yellow");
  60.                 Part.Material = Enum.Material.SmoothPlastic;
  61.                 Part.Reflectance = 0.5;
  62.             end
  63.         end
  64.     end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement