I’m trying to dynamically add a SpringConstraint between two parts (one anchored and one unanchored). However, whenever I do this, the unanchored part glitches out.
Try to add it to a Humanoid’s leg parts? The humanoid trips and flips out. Try to add it to a vehicle wheel? The vehicle glitches out and the wheel does really weird things.
here’s a really crappy repro which, while crappy and slapped together in about 5 minutes, demonstrates the issue: SpringConstraintThingyRepro.rbxl (68.8 KB)
If you drive the vehicle over the amazing spring attachy part, it will create two Attachments and a SpringConstraint with MaxForce==0… but the vehicle absolutely throws a fit and so will your character if you walk over the part.
This hinders the ability to create something like a grappling hook, or an attachable rope, or stuff like that, because adding the constraints causes glitchiness.
Do any of you clever forum members have a workaround for this, or maybe would any Roblox staff member help get it fixed? Or maybe I’m doing it completely wrong?
The script intentionally sucks to demonstrate the issue.
Took a copy of your repro file and stepped slowly through the process.
Then had a look at the Script under Part.
I am wondering if there is some side effect to creating and assigning the attachment in the same statement. I suggest that as this has been mentioned numerous times.
I also extended the wait to 20 to have a look in the explorer and put a print in front of the wait.
The print fired twice.
Perhaps you need a debounce.
I don’t have a debounce because I don’t need one
As in, what a debounce does is not something I want.
I added a
wait() before parenting the constraint to the part, but it doesn’t change anything.
springConstraint.Parent = script.Parent
As soon as the constraint is attached, the part instantly flips out. If you set the wait to 1 and walk on one of the corners, as soon as the wait is over and the spring attaches, instant flipout.
I would love to get a staff member on this, but as a “new member” I don’t have permission to post in any of the categories. Oh well.
Welding any part that has constraints to another part triggers this issue. If you have the springs on you and you sit in a vehicle, the vehicle flips out in that case too.
The vehicle steering also acts really weird, and rotates the entire car when you try to steer, if the springs are attached to the wheels (and the vehicle manages to recover after gaining said springs from the Magical Spring Part). Why are these bugs so… weird?
Would love to see what the staff think of this. I might contact post approval to get this moved to engine bugs if I don’t get a response soon.
Waiting for RunService.Heartbeat (as in via :Wait()) before creating/attaching the spring constraint (but after doing everything else) seems to have a baaaarely less glitchy effect. I’ve implemented that workaround for now.
The workaround doesn’t seem to have a noticeable effect in the attached repro, though. I’m doing it a bit differently in my version. Let me know if you want me to make another repro which (hopefully) demonstrates this?
Glad to see you have some reduction of the problem.
If you want me to look into it more then please supply a repro of what you have now.
I’d rather have a staff member / engineer / someone with a deeper understanding of exactly what is going on here look at it. I contacted post approval to try to get the post moved, but things aren’t looking great from here.