Advertisement
TaylorsRus

Untitled

Nov 28th, 2021
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.44 KB | None | 0 0
  1. local Player = game:GetService("Players").LocalPlayer
  2. local mouse = Player:GetMouse()
  3. local UInput = game:GetService("UserInputService")
  4. local sf = {
  5.     Rock_KeyCode = "R",
  6.     Despawn_Time = 50,
  7.     Rock_speed = 100,
  8.     cooldown = 1,
  9.     Rock_Gravity = 50
  10. }
  11. local RockCD = false
  12. local Debris = game:GetService("Debris")
  13.  
  14.  
  15. local function actualRock(plr, chr)
  16.    
  17.     local Rock = script.rak:Clone()
  18.     Rock.CanCollide = false
  19.     Rock.CanTouch = true
  20.     Rock.Anchored = false
  21.     Rock.Size = Vector3.new(2,2,2)
  22.     Rock.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2)
  23.     Rock.CFrame = CFrame.new(Rock.Position, mouse.Hit.p)
  24.     local effects = Instance.new("Folder")
  25.     effects.Parent = workspace
  26.     effects.Name = "Effects"
  27.     Debris:AddItem(Rock, sf["Despawn_Time"])
  28.    
  29.     local r = RaycastParams.new()
  30.     r.FilterType = Enum.RaycastFilterType.Blacklist
  31.     r.FilterDescendantsInstances = {workspace.Effects, plr.Character}
  32.     r.IgnoreWater = true
  33.     local obj = plr.Character
  34.     local X = obj.HumanoidRootPart.Position.X
  35.     local Z = obj.HumanoidRootPart.Position.Z
  36.     local result = workspace:Raycast(Vector3.new(X, plr.Character.HumanoidRootPart.Position.Y, Z), Vector3.new(0,-20,0), r)
  37.     if result then
  38.         local crack = script.crack:Clone()
  39.         crack.Parent = workspace
  40.         crack.CFrame = CFrame.new(chr.Torso.Position.X, result.Position.Y, chr.Torso.Position.Z)
  41.         if result.Instance:IsA("Terrain") then
  42.             Rock.Color = result.Instance:GetMaterialColor(result.Material)
  43.         else
  44.             Rock.Color = result.Instance.Color
  45.         end
  46.         Rock.Material = result.Material
  47.     end
  48.    
  49.     local bf = Instance.new("BodyForce")
  50.     bf.Force = Vector3.new(0,sf["Rock_Gravity"], 0)
  51.     bf.Parent = Rock
  52.     Rock.Parent = workspace
  53.     Rock.Velocity = CFrame.new(plr.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * sf["Rock_speed"]
  54.     Rock.Touched:Connect(function(touch)
  55.         print(touch)
  56.         if touch.Parent == plr.Character or touch.Parent.Parent == plr.Character then
  57.         else
  58.             Rock.Anchored = true
  59.             Rock.Attachment.Dust:Emit(100)
  60.             task.wait(2)
  61.             bf:Destroy()
  62.             task.wait(1)
  63.             Rock:Destroy()
  64.             effects:Destroy()
  65.         end
  66.     end)
  67. end
  68. UInput.InputBegan:Connect(function(input)
  69.     if input.KeyCode == Enum.KeyCode[sf["Rock_KeyCode"]] and RockCD == false then
  70.         RockCD = true
  71.         Player.Character.Humanoid.WalkSpeed -= 16
  72.         task.wait(1.5)
  73.         actualRock(Player, Player.Character)
  74.         task.wait(1.5)
  75.         Player.Character.Humanoid.WalkSpeed += 16
  76.         task.wait(sf["cooldown"])
  77.         RockCD = false
  78.     end
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement