Spinning part that player sticks to

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    A spinning part that runs on the client that the player sticks to

  2. What is the issue? Include screenshots / videos if possible!
    I have found ways to make it spin but it wont stick or it isnt good

  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    Hinge acting as a motor (really wierd movement on the client)
    Tweening an anchored part and welding to an unanchored part (player wont stick)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

How i did the tweening

for _, part in ipairs(CollectionService:GetTagged("SpinningPart")) do
	if part:IsA("Model") then
		task.spawn(function()
			while true do
				local info = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

				local Current = 1

				local properties = {
					[1] = {
						CFrame = part.Part.CFrame * CFrame.Angles(math.rad(0), math.rad(120), math.rad(0))
					},
					[2] = {
						CFrame = part.Part.CFrame * CFrame.Angles(math.rad(0), math.rad(240), math.rad(0))
					},
					[3] = {
						CFrame = part.Part.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
					}
				}

				local tween = TweenService:Create(part.Part, info, properties[Current])
				tween:Play()
				Current += 1
				tween.Completed:Wait()
				tween:Destroy()
			end
		end)		
	end
end

How im setting up physics related stuff on the client

for _, object in ipairs(ClientPhysics) do
	local oldParent = Instance.new("ObjectValue")
	oldParent.Value = object.Parent
	object.Parent = script.Parent
	if object:IsA("BasePart") or object:IsA("Model") then		
		local newObject = object:Clone()
		newObject.Parent = oldParent.Value
		for _, bp in ipairs(newObject:GetDescendants()) do
			if bp:IsA("BasePart") then
				bp.CollisionGroup = "ClientPhysics"
				if bp.Name == "Unanchor" then
					bp.Anchored = false
				end
			end
		end
		object:Destroy()
	end
	oldParent:Destroy()
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

I believe you are attempting to make the spinner carry the player (basically a traditional spinner found in obbies), you can use a cylindrical constraint instead of tweening the part’s CFrame rotation. You can also use a weld & a seat, but I do not recommend.

1 Like

This worked perfectly! Thanks.
Im wondering if theres a similar way to do that but with moving parts that are moving between 2 destinations since the way im doing it is with tweening while changing the angularlinearvelocity but that seems inefficient. I tried using alignposition but that for some reason didnt pick up the player. If you cant help me thanks anyway though.

If I understand where you’re getting at, I made a post about conserving momentum when walking around on a moving platform. (and yes it does carry the character around) Attach player to platform being moved by Cframes without welding them - #2 by Jayigon

Wouldn’t this also move the player if they have jumped?
I also found a problem similar to the other spinning part i have made, i will attach a video.

Does not for spinning parts and I am not entirely sure how to make it so that the player stays on the spinner whilst jumping. Also I set the cylindricalConstraint as type Motor, depends how you set each of your values.

Could it be because of the method im using to setup clientsided physics parts?
this is the script

for _, object in ipairs(ClientPhysics) do
	local oldParent = Instance.new("ObjectValue")
	oldParent.Value = object.Parent
	object.Parent = script.Parent
	if object:IsA("BasePart") or object:IsA("Model") then		
		local newObject = object:Clone()
		newObject.Parent = oldParent.Value
		for _, bp in ipairs(newObject:GetDescendants()) do
			if bp:IsA("BasePart") then
				bp.CollisionGroup = "ClientPhysics"
				if bp.Name == "Unanchor" then
					bp.Anchored = false
				end
			end
		end
		object:Destroy()
	end
	oldParent:Destroy()
end

Yeah, in this case cylindrical constraints do not need scripts to rotate or carry characters, (setting the right actuator type and values is likely more than enough for a spinner) unless you are operating a car steer/throttle values.

No im not using using a script to tamper with the constraint but i need everything that physically changes in the game to only happen on the client, this helps also since i might have a lot and it will put lots of load on the server. im basically cloning and unanchoring parts. which from my experience so far is replicating only on the client. im pretty sure that if i do everything on the server it will work fine though. is there a way to make it simulate only on the client but it doesnt bug out?
ive just tried out the spinner serverside and it works fine

A server script should do fine, you can check if the player is far enough so that each instance that has scripts does not run all at once. Well it’s around 4 am in the morning for me, good luck on fixing the spinner.

ill tamper around with my script then. Thanks alot for the recommendation of a cylinderconstraint!

1 Like

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