#Punch and Damage Script

7 messages · Page 1 of 1 (latest)

north barn
#

Please either dm me or type here if you are willing to help

north barn
#

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Punch")
local ContextActionService = game:GetService("ContextActionService")

stray spear
#

studio** You are now Level 2! **studio

north barn
#

local Punch = Instance.new("Animation")
Punch.AnimationId = "rbxassetid://8698951881"

local IsPunching = false

#

local function PunchAction()
if IsPunching == false then
IsPunching = not IsPunching

    local Punch = Humanoid:LoadAnimation(Punch)

    Punch:Play()

    Remote:FireServer()

    Punch.Stopped:Wait()

    IsPunching = not IsPunching
end

end

ContextActionService:BindAction("Punch", PunchAction, true, Enum.KeyCode.E)
ContextActionService:SetPosition("Punch", UDim2.new (0.72, -25, 0.20, -25))
ContextActionService:SetTitle("Punch", "Punch")

#

that all of it and this is the damage script

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Punch")

Remote.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")

local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {Character}

local Origin = Character.HumanoidRootPart.Position
local Direction = Character.HumanoidRootPart.CFrame.LookVector * 5
local Result = workspace:Raycast(Origin, Direction, Params)