I’m making a client vfx replicated however i have come across a weird welding issue, whenever i deal damage while I’m also taking damage i get bugged like i tp to the victim and get stuck. i imagine it has something to do with the local script.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local collectionservice = game:GetService("CollectionService")
----Varibles
local Remotes = ReplicatedStorage.Remotes
local ClientVfx = Remotes.Client.ClientVFX
ClientVfx.OnClientEvent:Connect(function(Position,Name,Count,Time,Enabled, WeldTable)
local effecttag = collectionservice:GetTagged("Effect")
for i,v in pairs(effecttag) do
if v.Name == Name then
local cloneeffect = v:Clone()
if WeldTable == nil then
print("1")
cloneeffect.Parent = workspace
cloneeffect.Position = Position
else
print("2")
cloneeffect.Parent = workspace
cloneeffect.Position = Position
local weld = Instance.new("Weld")
weld.Part0 = WeldTable[1]
weld.Part1 = cloneeffect
weld.C0 = WeldTable[2]
weld.Parent = cloneeffect
end
for i,s in cloneeffect:GetChildren() do
if s:IsA("ParticleEmitter") then
s:Emit(s:GetAttribute("EmitCount"))
end
end
task.delay(Time, function()
cloneeffect:Destroy()
end)
end
end
end)
-----Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")
local ServerScriptService = game:GetService("ServerScriptService")
-----Modules
local BlockHandler = require(script.BlockHandler)
-----Remotes
local Remotes = ReplicatedStorage.Remotes
local ClientVfx = Remotes.Client.ClientVFX
local ClientAnimator = Remotes.Client.ClientAni
local DamageHandler = {}
----Example
local DmgTable = {
Damage = 7,
IsEvadable = true,
PostureDamage = 15,
Stunduration = 0,
}
function DamageHandler.ApplyDamage(character, Victim, DmgTable)
local CharacterHum = character:WaitForChild("Humanoid")
local VictimHum = Victim:WaitForChild("Humanoid")
local victimHRP = Victim:FindFirstChild("HumanoidRootPart")
local block = BlockHandler.Block(character, Victim, DmgTable)
if block == "Blocked" then return end
local weldtable = { victimHRP, CFrame.new() }
ClientVfx:FireAllClients(victimHRP.Position,"Damage",25,0.9,true, weldtable)
VictimHum:TakeDamage(DmgTable.Damage)
return "Hit"
end
return DamageHandler