Hi, I have a module where it edits a character’s weld. It works usually, but when a player respawns, it breaks and doesn’t give any erorrs.
The module script:
function Tween.TweenWeld(TargetLimb, StartCFrame, CFrame0, EasingDirection, EasingStyle, Duration)
local weldExists = false
local weld = nil
local appendiges = {RA, LA, RL, LL, Head}
local correspondingJoints = {Torso:WaitForChild("Right Shoulder" , .2), Torso:WaitForChild("Left Shoulder" , .2), Torso:WaitForChild("Right Hip" , .2), Torso:WaitForChild("Left Hip" , .2), Torso:WaitForChild("Neck" , .2)}
local EndCFrame = {}
EndCFrame.C0 = CFrame0
local Info = TweenInfo.new(Duration,EasingStyle,EasingDirection)
for _, v in pairs(Torso:GetChildren()) do
if v.Name == "Weld" and v.Part1.Name == TargetLimb then
weldExists = true
weld = v
end
end
if not weldExists then
weld = Instance.new("Weld")
end
for i,v in pairs(appendiges) do
if TargetLimb == v.Name then
correspondingJoints[i].Part1 = nil
weld.Parent = Torso
weld.Part0 = Torso
weld.Part1 = v
weld.C0 = StartCFrame
local Animation = TweenService:Create(weld, Info, EndCFrame)
Animation:Play()
EditLimb:Fire("Tween" , TargetLimb, StartCFrame, CFrame0, EasingDirection, EasingStyle, Duration)
end
end
end
Because I want to move the players leg for example, to a specific c-frame smoothly, so I use welds along with tweens, and also so other players can see the players tween.
I literally have no idea what any of this means, but I’m assuming the script cant run when the character loads as it still thinks the older one is in workspace. I may be horribly wrong though.