After it’s done doing an attack, the movement becomes glitched. It does use welding in the attack but it deleted/disabled the welding & parts after it’s done. Does anyone know why this glitch is happening?
Code
local part = folder:FindFirstChildOfClass("Part")
if not part then return end
local opart = part
if typeof(position) == "Instance" then
part = position
else
local osize = part.Size
part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Transparency = 1
part.Position = position
part.Size = Vector3.new(0.1,0.1,0.1)
part.Parent = parent or Camera
end
local weld = nil
if lookvector and basepart then
local cf = CFrame.new(part.Position, (basepart.CFrame * CFrame.new(0, 0, -100)).p) * lookvector
part.CFrame = cf
if offset then
part.Position = (part.CFrame * offset).p
end
if weldto then
local part0 = basepart.Parent:FindFirstChild(weldto)
part.CanCollide = false
part.Anchored = false
weld = Instance.new("Weld")
weld.Part0 = part0
weld.Part1 = part
--weld.C1 = cf
if offset then
--weld.C1 = offset
end
weld.C0 = weld.Part0.CFrame:Inverse()
weld.C1 = weld.Part1.CFrame:Inverse()
weld.Parent = part0
else
end
end
delay((emdur or 2) + 0.2, function()
if weld then
weld.Enabled = false
--weld:Destroy()
if part then
part.Anchored = true
end
end
end)
delay((emdur or 2) + 1, function()
if weld then
weld:Destroy()
end
delay(0.1, function()
part:Destroy()
for i,v in pairs(list) do
if v then
v:Destroy()
table.remove(list, i)
end
end
end)
end)