Player doesn't stick to model while it's spinning

  1. What do you want to achieve? I am trying to create a script that makes the model spin. It works but another issue has arisen.

  2. What is the issue? The player should stick on the spinning parts, however it doesn’t move along with the model

  3. What solutions have you tried so far? I have looked through the devforum and I found out how to spin models. However there doesn’t seem to be any documents about spinning the models while the player sticks to it. I also tried to use constraints (hinges and cylindrical constraints) but those are too unstable to keep the model in place.

local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")

local Model = script.Parent

while true do 
	Model:PivotTo(object:GetPivot() * CFrame.Angles(0, math.rad(1), 0))
	RunService.Heartbeat:Wait()
end

This is the script I used to spin the model.

1 Like
local RunService = game:GetService("RunService")

local Model = script.Parent

RunService.Heartbeat:Connect(function()
	Model:PivotTo(object:GetPivot() * CFrame.Angles(0, math.rad(1), 0))
end)
1 Like

This doesn’t solve the issue. Thanks for improving the script though!

1 Like

there isn’t a local object:Model = <target>

1 Like

Unfortunately, you cannot use these pivoting functions/properties to set the angle of a BasePart and expect the player controller to replicate along with it. You have to use AssemblyLinearVelocity for XYZ-position velocity, and AssemblyAngularVelocity for XYZ-angle velocity.

You can only have characters replicate along with part movement if you’re using velocity. The part must be unanchored for velocity to take effect, so use something like a LinearVelocity instance to lock the position in place, while having Angular velocity still take place.

If you’re confused, I can send you a place file to do just that.

1 Like

Could you send me the place file, please?

Yep, just give me a moment. Not on my computer at the moment.

Maybe you can try setting the player PrimaryPart to the rotating model, or a part in that model. With SetPrimaryPartCFrame you can move the PrimaryPart with every part in the model, and in this case also the player.

to make players able to move along with the spinner, ur going to need to use a motor hinge.

Read the top post. I already tried constraints like hinges but they’re too unreliable and the platform ends up somewhere else.

I unfortunately looked far and wide, and could not find the place file. However, let me try and explain it in terms to where you can try and replicate it yourself.

Instead of using pivoting methods/properties, use the physics system and lay the job onto Roblox’s physics system rather than the script.

Using pivoting just sets the position/orientation of the part, regardless of physics. Meaning that any physics enacting object that is standing on the part or relies on the physics of the part are completely ignored as setting the position is outside of the scope of the physics system.

For example, you could just set the rotational velocity of the part to random increments in a while loop. Granted, not as smooth, it works.
To get a smooth spin, you will need to use noise.

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