#Effects wont work properly
1 messages · Page 1 of 1 (latest)
Code???
its on the start of the recording
hitRootPart is just the HumanoidRootPart of the character being hit
local function HitEffect(hitRootPart)
local HitEffect = EffectsFolder:WaitForChild("VFX"):WaitForChild("HitEffect")
if not HitEffect then
return
end
local HitEffectClone = HitEffect:Clone()
HitEffectClone.Parent = hitRootPart
HitEffectClone.CanCollide = false
HitEffectClone.Massless = true
local weld = Instance.new("Weld")
weld.Parent = HitEffectClone
weld.Part0 = hitRootPart
weld.Part1 = HitEffectClone
Debris:AddItem(HitEffect, .1)
end
and this is the function that calls it
if action ~= "Attack" then
return
end
print("Received comboCount: " .. tostring(comboCount))
local Character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local DamageAmount = 5
local Debounce = false
local tool = Character:FindFirstChildOfClass("Tool")
if tool then
if tool:GetAttribute("ItemType") == "Weapon" then
DamageAmount = tool:GetAttribute("Damage")
elseif tool:GetAttribute("ItemType") ~= "Weapon" then
return
end
end
AttackEvent:FireClient(player, comboCount)
local Hitbox = CreateHitbox(Character)
Hitbox.Touched:Connect(function(hit)
local hitHumanoid = hit.Parent:FindFirstChild("Humanoid")
local hitRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
if hitHumanoid and hitHumanoid ~= Humanoid and not Debounce then
Debounce = true
print("You hit " .. hitHumanoid.Parent.Name .. "!")
print("Damage: " .. DamageAmount)
task.wait(0.1)
hitHumanoid:TakeDamage(DamageAmount)
HitSound(hitRootPart)
HitEffect(hitRootPart)
Knockback(Character, hitRootPart)
task.wait(1)
Debounce = false
end
end)
end
AttackEvent.OnServerEvent:Connect(Attack)```