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.
What is the issue? The player should stick on the spinning parts, however it doesn’t move along with the model
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
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)
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.
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.
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.