Players falling off of moving part

I am making an obby and have a spinning part players can stand on, I used tween and align position to make the players be able to stand on the part. It actually works fine at first then after about 15-20 seconds into testing the players stops being able to stand on the spinning part and the spinning part just falls from underneath them. This is really weird and I have no idea what might cause this. By the way the spinning part is actually a union, I don’t think it changes anything but just fyi.

local TweenService = game:GetService("TweenService")
local model = script.Parent
local ref = model.Reference

local tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, false, 0)
local properties = {Orientation = Vector3.new(0, 360, 0)}
local tween = TweenService:Create(ref, tweeninfo, properties)
tween:Play()
2 Likes

I tested it myself and i had no such problem (i tested it with both a part and union), i think it’s because of the Union. You should try to just use Parts and if you were to use multiple parts weld them together.

do you think maybe it is just a studio glitch and will work in the actual game?

I have no idea, i think it won’t work in the actual game tho.

could you send the model you made just so I can see if i missed anything

Rotating an object with cframe does not cause any physical changes to its touching parts.
U should use velocity

local function CreateSpinningPart(part : BasePart,AngularVelocity : Vector3,Position : Vector3)
	Position = Position or part.Position
	AngularVelocity = AngularVelocity or Vector3.new(0,10,0)
	
	local TerrainAtt = Instance.new("Attachment",workspace.Terrain)
	TerrainAtt.WorldPosition = Position
	
	local PartAtt =Instance.new("Attachment",part)
	local AP = Instance.new("AlignPosition",part)
	AP.Attachment0 = PartAtt
	AP.Attachment1 = TerrainAtt
	AP.MaxForce = math.huge
	
	local AV = Instance.new("AngularVelocity",part)
	AV.Attachment0 = PartAtt
	AV.MaxTorque = math.huge
	AV.AngularVelocity = AngularVelocity
end

CreateSpinningPart(workspace.Part)

Here is a one with better Orientation handeling

local function CreateSpinningPartNew(part : BasePart,AngularVelocity : Vector3,Position : Vector3)
	Position = Position or part.Position
	AngularVelocity = AngularVelocity or Vector3.new(0,.1,0)
	AngularVelocity = CFrame.Angles(AngularVelocity.X,AngularVelocity.Y,AngularVelocity.Z)
	
	local TerrainAtt = Instance.new("Attachment",workspace.Terrain)
	TerrainAtt.WorldPosition = Position
	
	local PartAtt = Instance.new("Attachment",part)
	local AP = Instance.new("AlignPosition",part)
	AP.Attachment0 = PartAtt
	AP.Attachment1 = TerrainAtt
	AP.MaxForce = math.huge
	AP.Responsiveness = 200
	
	local AO = Instance.new("AlignOrientation",part)
	AO.Attachment0 = PartAtt
	AO.Mode = Enum.OrientationAlignmentMode.OneAttachment
	AO.MaxTorque = math.huge
	AO.CFrame = part.CFrame
	AO.Responsiveness = 200
	
	AO.Enabled = false
	game:GetService("RunService").Heartbeat:Connect(function()
		AO.CFrame *= AngularVelocity
	end)
	AO.Enabled = true
end
4 Likes

As stated, Anchored parts that are CFramed or Tweened don’t actually move physically.

Try a HingeConstraint with its ActuatorType set to Motor, then make sure you have the settings in the HingeConstraint MotorMaxTorque and AngularVelocity configured to make the Part rotate how you want it.

What if I wanted to make it so that the part moves like 10 studs up and then back down instead of rotating

local function CreateElevator(part : BasePart,FirstPosition : Vector3,SecondPosition : Vector3,Delay : Number, Velocity : Number)
	FirstPosition = FirstPosition or part.Position
	SecondPosition = SecondPosition or part.Position + Vector3.new(0,10,0)
	Delay = Delay or 5
	Velocity = Velocity or 10

	local TerrainAtt = Instance.new("Attachment",workspace.Terrain)
	TerrainAtt.WorldPosition = FirstPosition
	
	local PartAtt =Instance.new("Attachment",part)
	local AP = Instance.new("AlignPosition",part)
	AP.Attachment0 = PartAtt
	AP.Attachment1 = TerrainAtt
	AP.Responsiveness = Velocity
	AP.MaxForce = math.huge

	while task.wait(Delay) do
		TerrainAtt.WorldPosition = FirstPosition
		task.wait(Delay)
		TerrainAtt.WorldPosition = SecondPosition
	end
end

CreateElevator(workspace.Part)

P.S i did a mistake please copy it again

2 Likes

I copied it again after the changes and it doesn’t work right. It does move up and down but it is spinning upside down while it does that.

here use this one with better orientation handling

Look in my models for a platform model (I’m not on Roblox right now) that I built for another person as an example.
It uses a PrismaticConstraint to do exactly what you want.

Hey, I just released a YouTube video that answers how to keep players on a part that moves back and forth in case anyone clicks on this thread looking for that

2 Likes