#For some reason my punching script doesnt work

9 messages · Page 1 of 1 (latest)

oak axle
#

local rs = game:GetService("ReplicatedStorage")
local strikeRe = rs:WaitForChild("StrikeRe")

local uis = game:GetService("UserInputService")

local canStrike = true
local hookCoolDown = .3

local hookKey = Enum.UserInputType.MouseButton1

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

local hookAnim = script:WaitForChild("HookAnim")
local hookAnimTrak = hum.Animator:LoadAnimation(hookAnim)
local snd = script:WaitForChild("Sound")

local function hookPunch()
if canStrike and hum.Health > 0 then
canStrike = false
print("We are doing a hook punch")
hookAnimTrak:Play()
snd:Play()
strikeRe:FireServer("Hook")
wait(hookCoolDown)
canStrike = true
end
end

uis.InputBegan:Connect(function(input, gameProcess)
if input.UserInputType == hookKey then
hookPunch()
end
end)

#

local function doStrike(player, hitPos, area, damage)
local playerList = game.Players:GetChildren()
local npcList = workspace.NPCs:GetChildren()

for i, v in pairs(playerList) do
    if player.UserId ~= v.UserId then
        if not player.Team or player.Team ~= v.Team then
            doDamage(player, v.Character, hitPos, area, damage)
        end
    end
end

for i, v in pairs(npcList) do
    doDamage(player, v, hitPos, area, damage)
end

end

local function handleStrikeRe(player, strikeType)
local char = player.Character
local hrp, hum = getHrpAndHumFromChar(char)
if hrp and hum and hum.Health > 0 then
if strikeType == "Hook" then
local pos = (hrp.CFrame+hrp.CFrame.LookVector*hookReach).Position
doStrike(player, pos, hookArea, hookDamage)
end
end
end

strikeRe.OnServerEvent:Connect(handleStrikeRe)

#

local fightUtils = {}

function fightUtils:knockBack(pChar, eChar)
if pChar and eChar then
local pHrp = pChar:FindFirstChild("HumanoidRootPart")
local eHrp = eChar:FindFirstChild("HUmanoidRootPart")
if pHrp and eHrp then
local force = Instance.new("BodyVelocity", eHrp)
force.Maxforce = Vector3.new(1, 1, 1) * math.huge
local dir = (eHrp.CFrame.Position - pHrp.CFrame.Position).Unit
force.Velocity = (dir + Vector3.new(0, 1, 0)).Unit * 50
game.Debris:AddItem(force, .25)
local rot = Instance.new("BodyAngularVelocity", eHrp)
rot.AngularVelocity = Vector3.new(1, 1, 1) * math.pi * 2.5
rot.MaxTorque = Vector3.new(1, 1, 1) * math.huge
rot.P = 10000
game.Debris:AddItem(rot, .25)
end
end
end

return fightUtils

unborn slate
#

Don't post your script 3 times ffs

#

Also

#

Do this ^^

oak axle
#

Wha

tacit sleet
#

studio** You are now Level 1! **studio