• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


01 Dec, 2024

Updated at 02 Dec, 2024

Unwanted Behavior for Drag Detector + Rotation System

Hello, everyone!

Recently I’ve been working on a game that works like Jenga, and while I have most systems for base gameplay in place, I’ve encountered a problem.

I am using drag detectors that use the “TranslatePlaneOrLine” drag mode. I have one for every part in the tower, and I’ve incorporated an “R to rotate” system. However, the parts very quickly reset their rotation after I continue dragging the part. Below is the code that handles the system.

	RotateBrick.OnServerEvent:Connect(function(player, partToRotate: BasePart)
		if not partToRotate or not partToRotate:IsA("BasePart") then return end

		local currentOrientation = partToRotate.Orientation

		local newOrientation = Vector3.new(
			currentOrientation.X,
			currentOrientation.Y + 90,
			currentOrientation.Z
		)

		partToRotate.Orientation = newOrientation
	end)

That’s part of a ModuleScript if that changes anything. Furthermore, here’s a video that demonstrates the issue further:

Is this simply a drag detector quirk, or is this a problem with my code? Thanks, Citrus.

1 post - 1 participant

Read full topic