This piece of code doesn’t glitch when I fire it on its own, but when I use it in a different area, it kills me:
for i, joint in pairs(character:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint.Enabled = false
end
end
The “different area” is a function and doesn’t have any code on top of it or on the bottom of it. On the top, it only has a simple if statement checking for humanoid root parts. My code is organized, and I’ve been dealing with this problem for over an hour, and testing so many predicaments. There is a damage system when this function runs, but I’ve tested it enough and noticed when I comment out the function it’ll damage my guy, but not kill him. This does not run hundreds of times and glitches, there is a debounce.
Also note, this isn’t in a .Died function, and even with disabling damage, it still kills me instantly.
Thanks.