What's causing this error to appear?

I’m getting this error 1 out of every 5 times I playtest my game. How can I resolve this issue?

Usually, when you get an intermittent problem like this, it’s a race condition. In looking at your code, RigidJoint is a value. What value is it? It can’t be an instance like you are accessing it, which I think is part of the problem.

RigidJoint is an ObjectValue under one of the constraints in the player. Could this error be happening because it’s not able to load in every time?

image

Try adding WaitForChild for RigidJoint
local RigidJoint = Constraint.RigidJoint.Value
local RigidJoint = Constraint:WaitForChild("RigidJoint").Value

If that doesn’t work then the Value itself is being deleted for some reason.
I would also add a print
print(Constraint:FindFirstChild(RigidJoint)