Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UIS = game:GetService("UserInputService")
- local RS = game:GetService("ReplicatedStorage")
- local RunS = game:GetService("RunService")
- local Player = game.Players.LocalPlayer
- local CraterEffect = require(game.ReplicatedStorage.CraterModule)
- local Character = Player.Character
- local Space = false
- local LastHit = 0
- local ResetCooldown = 2
- local Event
- local Distance = 4.5
- function EnableJump()
- Character.Humanoid.JumpPower = 50
- end
- function DisableJump()
- Character.Humanoid.JumpPower = 0
- end
- UIS.InputBegan:Connect(function(Input, IsTyping)
- if IsTyping then return end
- if Input.UserInputType == Enum.UserInputType.MouseButton1 then
- local Eyes = Character.HumanoidRootPart.CFrame.LookVector
- local RayCastPara = RaycastParams.new()
- RayCastPara.FilterDescendantsInstances = {Player.Character}
- RayCastPara.FilterType = Enum.RaycastFilterType.Blacklist
- local RayHitBox = workspace:Raycast((Character.HumanoidRootPart.CFrame).p, Eyes * Distance, RayCastPara)
- RS.CombatEvent:FireServer(RayHitBox and RayHitBox.Instance, Space)
- DisableJump()
- LastHit = tick()
- Event = RunS.Heartbeat:Connect(function()
- if tick() - LastHit <= LastHit then return end
- EnableJump()
- Event:Disconnect()
- Event = nil
- end)
- elseif Input.KeyCode == Enum.KeyCode.Space then
- Space = true
- end
- end)
- UIS.InputEnded:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode.Space then
- Space = false
- end
- end)
- RS.CombatEvent.OnClientEvent:Connect(function(Player,Value, TargetCFrame)
- EnableJump()
- if not Value or not TargetCFrame then return end
- if Value == "Downed" then
- task.wait(.2)
- CraterEffect.Create(8, (TargetCFrame).Position, 2)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement