Prismatic Constraint just breaking after trying to get to target position?

  • Platform
    – Has a ProximityPrompt, and a Attachment (named PlatformAttachment)
  • Track
    – Has Prismatic Constraint, and a Attachment (named TrackAttachment)
  • Script
    – Elevator Script.

– All above is in a model named “Elevator”

Script:

local platform = script.Parent.Platform
local prismaticConstraint = script.Parent.Track.PrismaticConstraint

platform.ProximityPrompt.Triggered:Connect(function(player)
	print(prismaticConstraint.CurrentPosition)
	if prismaticConstraint.CurrentPosition <= -9 then
		prismaticConstraint.TargetPosition = 0
        print("1")
	else if prismaticConstraint.CurrentPosition >= 9 then
			prismaticConstraint.TargetPosition = -28
            print("2")
		end
	end
end)

Model and Parts:


– In the second image, the attachments are attached.

So I went off of this Elevator Tutorial, and got the script from there. I followed every instruction it asked me to do. And whenever I test it, The part will go to the designated first target. But when I interact with the proximity prompt, it breaks and falls to the ground? I started playing with the limits, and then moving the attachments closer to the parts and it still does break and fall when I interact with it. I even changed the numbers several times and nothing has been working. I reread the tutorial and went through the steps but nothing at all is working?? I have the track at a different height, but that should not change anything if I adjust the limits to fit the track size.

It will only print the (“1”) and where the position of the platform is currently, but will not print 2 because it isn’t equal or greater to 9.

1 Like