#my vfx keeps bugging

1 messages · Page 1 of 1 (latest)

shy cipher
winged garden
shy cipher
#

local playerCooldowns = {}
local ATTACK_COOLDOWN = 0.6
game.ReplicatedStorage.Remotes.Combat.OnServerEvent:Connect(function(plr, arg)
if arg == "M1" then
local currentTime = tick()
local userId = plr.UserId
if playerCooldowns[userId] and currentTime - playerCooldowns[userId] < ATTACKCOOLDOWN then
return
end
playerCooldowns[userId] = currentTime
local size = Vector3.new(3, 4, 3)
local region = Region3.new(plr.Character.HumanoidRootPart.Position - size, plr.Character.HumanoidRootPart.Position + size)
local partsInRegion = workspace:FindPartsInRegion3(region, nil, math.huge)
local hits = {}
for , part in pairs(partsInRegion) do
local Character = part.Parent
if Character and Character:FindFirstChild("Humanoid") and Character.Name ~= plr.Name then
if hits[Character] then
continue
end

#

hits[Character] = true
if Character:HasTag("Parry") then
if not Character:FindFirstChild("ParryEffect") then
local parryeffect = game.ReplicatedStorage.Assets.ParryEffect.Attachment:Clone()
parryeffect.Parent = Character.HumanoidRootPart
parryeffect.Name = "ParryEffect"
local sound = game.ReplicatedStorage.Assets.ParryEffect.ParrySF:Clone()
sound.Parent = Character.HumanoidRootPart
sound.Volume = 50
sound:Play()
task.spawn(function()
task.wait(0.1)
for _, v in pairs(parryeffect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
end)

                    game.Debris:AddItem(sound, 2)
                    game.Debris:AddItem(parryeffect, 1.5)
                end
#

else
local humanoid = Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(1)
end
task.spawn(function()
local hiteffect = game.ReplicatedStorage.Assets.HitEffect.Attachment:Clone()
hiteffect.Parent = Character.HumanoidRootPart
local sound = game.ReplicatedStorage.Assets.HitEffect.P1:Clone()
sound.Parent = Character.HumanoidRootPart
sound.Volume = 50
sound:Play()
for _, v in pairs(hiteffect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local anim = Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.EnemyHit)
anim:Play()
local originalSpeed = Character.Humanoid.WalkSpeed
Character.Humanoid.WalkSpeed = 5
task.wait(0.8)
Character.Humanoid.WalkSpeed = originalSpeed
game.Debris:AddItem(sound, 2)
game.Debris:AddItem(hiteffect, 2)
game.Debris:AddItem(anim, 1.5)
end)
end
end
end
elseif arg == "ParryOn" then
plr.Character:AddTag("Parry")
elseif arg == "ParryOff" then
plr.Character:RemoveTag("Parry")
if plr.Character:FindFirstChild("ParryEffect") then
plr.Character.ParryEffect:Destroy()
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
playerCooldowns[plr.UserId] = nil
end)

next rover
#

what do you exactly need?

shy cipher