I want to make the dummy take damage on every m1. I havent found any posts similiar to this. I have literally zero idea why its doing this.
local moves = {}
local RP = game.ReplicatedStorage
local Animations = RP.Animations
local Events = RP.Events
local Values = RP.Values
local Players = game.Players
local mod = RP.Modules
local r = require(mod.Ragdoll)
local Main = workspace.Main
-- setup ragdolls
r:Setup(Main['BlockDummy'])
r:Setup(Main['Combat Animation'])
r:Setup(Main['Dummy'])
local CreateHitbox =
function(
character : model,
parent : instance,
position : vector3,
size : vector3,
damage : number,
Stun : boolean,
StunTime : number,
Ragdoll : boolean,
RagdollTime : boolean,
Destroy : boolean,
ImpactVFX : instance,
duration : number,
PactDUration : number
)
local newHitbox = Instance.new('Part') do
newHitbox.Name = 'Hitbox'
newHitbox.Size = size
newHitbox.Position = parent.CFrame:PointToWorldSpace(position)
newHitbox.Orientation = Vector3.new(0,0,0)
newHitbox.Anchored = false
newHitbox.CanCollide = false
newHitbox.Material = Enum.Material.ForceField
newHitbox.BrickColor = BrickColor.new('Really red')
local weld = Instance.new('WeldConstraint') do
weld.Parent = newHitbox
weld.Part0 = parent
weld.Part1 = newHitbox
newHitbox.Parent = parent
end
game.Debris:AddItem(newHitbox, duration)
local function DO(hit)
if Destroy then
if hit:IsA('BasePart') then
hit:Destroy()
end
end
local humanoid = hit.Parent:FindFirstChild('Humanoid')
local char = hit.Parent
local plr = Players:GetPlayerFromCharacter(character)
if not plr then return end
local check = (humanoid)
local Network = false
local CD = {}
if (check) and not table.find(CD, hit.Parent.Name) then
if not char.Name:lower():match('stand') and char ~= character then
table.insert(CD, hit.Parent.Name)
if damage then
humanoid:TakeDamage(damage)
end
if Ragdoll then
r:Ragdoll(char)
task.delay(RagdollTime, function()
r:Ragdoll(char)
end)
end
if ImpactVFX then
local new = ImpactVFX:Clone()
new.Parent = hit
new.Position = hit.Position
task.delay(PactDUration, function()
new:Destroy()
end)
end
newHitbox:Destroy()
end
end
end
local connection = nil
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {character}
newHitbox.Touched:Connect(DO)
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local new = Values:Clone()
new.Parent = character
new.Stunned:GetPropertyChangedSignal('Value'):Connect(function()
local v = new.Stunned.Value
character.HumanoidRootPart.Anchored = v
end)
end)
end)
local function PlayAnimation(animation, humanoid)
local new = humanoid:LoadAnimation(animation)
new:Play()
return new
end
local function GetVariables(player)
local variables = {}
variables['Character'] = player.Character
variables['Humanoid'] = variables.Character['Humanoid']
variables['Values'] = variables['Character']['Values']
for i,v in variables['Values']:GetChildren() do
variables[v.Name] = v
end
return variables
end
local VFX = RP.VFX
local StandsFolder = RP.Stands
local function LoadStand(character)
if not Players:GetPlayerFromCharacter(character) then return end
local stand = GetVariables(Players:GetPlayerFromCharacter(character))['Stand']
if stand then
local find = StandsFolder:FindFirstChild(stand.Value)
if find then
find = find:Clone()
find.Name = character.Name..'_stand'
local plr = Players:GetPlayerFromCharacter(character)
find.Parent = workspace
if plr then
find.HumanoidRootPart:SetNetworkOwner(plr)
end
local function move()
local plr = game.Players:GetPlayerFromCharacter(character)
if not plr then return end
local behind = character.Values.Behind
if behind.Value then
local c = (character.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(2, 1, 3.5)))
find:PivotTo(c)
end
end
move()
while find:IsDescendantOf( workspace ) do
move()
task.wait(0.00000000000000000000000000000000000000000000000000000000001)
end
end
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(LoadStand)
end)
local Tween = Events:WaitForChild('Tween')
moves['Base'] = function(player, move)
local variables = GetVariables(player)
local skill1 = variables['1'] ; local skill2 = variables['2'] ; local skill3 = variables['3'] ; local skill4 = variables['4'] ; local m1CD = variables['M1CD'] ; local values = variables['Values'] ; local character = player.Character ; local humanoid = character.Humanoid
local m1Count = variables['M1Count'] ; local Stunned = variables['Stunned'] ; local Move = variables['Move']; local character = player.Character
if Stunned.Value then return end
if Move.Value ~= 'None' then return end
if move == 'm1' then
variables['Behind'].Value = false
Move.Value = 'M1'
if m1Count.Value >= 4 then
m1Count.Value = 1
end
m1Count.Value += 1
local found = Animations:FindFirstChild(tostring(m1Count.Value))
if m1Count.Value % 2 == 0 then
found = Animations:FindFirstChild('2')
else
found = Animations:FindFirstChild('1')
end
if found then
task.spawn(function()
local found_stand = workspace:FindFirstChild(player.Name..'_stand')
if found_stand then
local animation = PlayAnimation(found, found_stand.Humanoid)
local info = {0.25, Enum.EasingStyle.Linear, Enum.EasingDirection.In}
Tween:FireAllClients(found_stand.HumanoidRootPart, info, {CFrame = character.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0, 0, -5))})
local function doHitbox(arm)
task.delay(0.25, function()
CreateHitbox(
character,
found_stand[arm],
Vector3.new(0, 0, 0),
Vector3.new(3.5,3.5,3.5),
10,
true,
0.65,
false,
0,
false,
VFX.LightHit,
animation.Length+0.25,
0.5
)
task.wait(0.25)
local x, y, z = 2, 1, 3.5
Tween:FireAllClients(found_stand.HumanoidRootPart, info, {CFrame = character.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(x,y,z))})
task.wait(0.6)
variables['Behind'].Value = true
end)
end
if m1Count.Value % 2 == 0 then
doHitbox('Right Arm')
else
doHitbox('Left Arm')
end
animation.Ended:Wait()
local found = (found_stand['Right Arm']:FindFirstChild('Hitbox')) or (found_stand['Left Arm']:FindFirstChild('Hitbox'))
if found then
found:Destroy()
end
task.delay(0.5, function()
Move.Value = 'None'
end)
end
end)
end
end
end
Events.Move.OnServerEvent:Connect(function(player, move)
move = move:lower()
for i,v in moves do
if type(v) == 'function' then
v(player, move)
end
end
end)
return moves