I have a combat script that works fine as is, I'm just curious to see if theres any way I could edit it so that players could grab onto an opposing player if he manages to land a hit. Heres a snippet of the code.
local c = Player.Character
local function Punch(DMG)
--print("Punch has started")
local Region = Region3.new(V1-Vector3.new(3,1,1.5),V1+Vector3.new(3,1,1.5))
local RTable = workspace:FindPartsInRegion3(Region, nil, 20)
for i,v in pairs(RTable) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent:FindFirstChild("Deb") == nil and v.Parent ~= c then
local Deb = Instance.new("BoolValue", v.Parent)Deb.Name = "Deb"
game.Debris:AddItem(Deb,0.2)
if v.Parent:FindFirstChild("Blocking") then
v.Parent.Humanoid:TakeDamage(DMG / 2)
print("DAMAGE IS"..tostring(DMG))
local S = Instance.new("Sound", v)
S.SoundId = "rbxassetid://3626698892"
S.PlaybackSpeed = math.random(80,120)/100
S:Play()
elseif v.Parent:FindFirstChild("PerfectBlocking") then
v.Parent.Humanoid:TakeDamage(DMG / 3)
print("DAMAGE IS"..tostring(DMG))
local S = Instance.new("Sound", v)
S.SoundId = "rbxassetid://161995135"
S.PlaybackSpeed = math.random(80,120)/100
S:Play()
else
v.Parent.Humanoid:TakeDamage(DMG)
print("DAMAGE IS"..tostring(DMG))
local S = Instance.new("Sound", v)
S.SoundId = "rbxassetid://1089136667"
S.PlaybackSpeed = math.random(80,120)/100
S:Play()
end
end
end
end
This function runs everytime the player clicks. Any help will be appreciated.
