Prismatic Constraint not working no matter what


image
The script in the proximity prompt, no matter how much it’s triggered, won’t make the part move.

local platform = script.Parent:WaitForChild("Platform")
local prismaticConstraint = script.Parent:WaitForChild("Track").PrismaticConstraint

platform.ProximityPrompt.Triggered:Connect(function(player)
	print(prismaticConstraint.CurrentPosition)
	if prismaticConstraint.CurrentPosition <= -41 then
		prismaticConstraint.TargetPosition = 32
	else if prismaticConstraint.CurrentPosition >= 31 then
			prismaticConstraint.TargetPosition = -42
		end
	end
end)
1 Like

I’m not sure how you set up your model, but your code worked with this setup I used:


I also didn’t modify the script at all and I didn’t change any properties of the prismatic constraint either. I did have to turn off CanCollide for the part named “part” though so the track could slide through it.

1 Like

Before you take your screenshots go to the Model tab and click the Show Welds and Show Constraints buttons so we can actually see them.

Is the platform Anchored?
Is the platform welded to anything?
Is the print line in the function printing the CurrentPosition? If it isn’t then your Prompt isn’t firing the function.
Is the print line printing a value between -41 and 31? If it is then your if elseif checks aren’t going to ever work.
Crank up your PrismaticConstraint ServoMaxForce to about a trillion, and for Pete’s sake turn the Speed down. 500 studs per second is wayyyy too high.

1 Like

the part was a height measure. i was measuring the studs

I fixed it myself. (Keystroke)

2 Likes

Please let everyone know what you did to solve it so if anyone’s searching for a solution to their similar problem they can see how you did it.

It seems like the parts were anchored and probably the max force too

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.