Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game:GetService("Players").LocalPlayer
- local mouse = Player:GetMouse()
- local UInput = game:GetService("UserInputService")
- local sf = {
- Rock_KeyCode = "R",
- Despawn_Time = 50,
- Rock_speed = 100,
- cooldown = 1,
- Rock_Gravity = 50
- }
- local RockCD = false
- local Debris = game:GetService("Debris")
- local function actualRock(plr, chr)
- local Rock = script.rak:Clone()
- Rock.CanCollide = false
- Rock.CanTouch = true
- Rock.Anchored = false
- Rock.Size = Vector3.new(2,2,2)
- Rock.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2)
- Rock.CFrame = CFrame.new(Rock.Position, mouse.Hit.p)
- local effects = Instance.new("Folder")
- effects.Parent = workspace
- effects.Name = "Effects"
- Debris:AddItem(Rock, sf["Despawn_Time"])
- local r = RaycastParams.new()
- r.FilterType = Enum.RaycastFilterType.Blacklist
- r.FilterDescendantsInstances = {workspace.Effects, plr.Character}
- r.IgnoreWater = true
- local obj = plr.Character
- local X = obj.HumanoidRootPart.Position.X
- local Z = obj.HumanoidRootPart.Position.Z
- local result = workspace:Raycast(Vector3.new(X, plr.Character.HumanoidRootPart.Position.Y, Z), Vector3.new(0,-20,0), r)
- if result then
- local crack = script.crack:Clone()
- crack.Parent = workspace
- crack.CFrame = CFrame.new(chr.Torso.Position.X, result.Position.Y, chr.Torso.Position.Z)
- if result.Instance:IsA("Terrain") then
- Rock.Color = result.Instance:GetMaterialColor(result.Material)
- else
- Rock.Color = result.Instance.Color
- end
- Rock.Material = result.Material
- end
- local bf = Instance.new("BodyForce")
- bf.Force = Vector3.new(0,sf["Rock_Gravity"], 0)
- bf.Parent = Rock
- Rock.Parent = workspace
- Rock.Velocity = CFrame.new(plr.Character.HumanoidRootPart.Position, mouse.Hit.p).lookVector * sf["Rock_speed"]
- Rock.Touched:Connect(function(touch)
- print(touch)
- if touch.Parent == plr.Character or touch.Parent.Parent == plr.Character then
- else
- Rock.Anchored = true
- Rock.Attachment.Dust:Emit(100)
- task.wait(2)
- bf:Destroy()
- task.wait(1)
- Rock:Destroy()
- effects:Destroy()
- end
- end)
- end
- UInput.InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode[sf["Rock_KeyCode"]] and RockCD == false then
- RockCD = true
- Player.Character.Humanoid.WalkSpeed -= 16
- task.wait(1.5)
- actualRock(Player, Player.Character)
- task.wait(1.5)
- Player.Character.Humanoid.WalkSpeed += 16
- task.wait(sf["cooldown"])
- RockCD = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement