Rotating Stage (For a Theatre)

Hi everyone!!

I’ve been looking into a rotating stage for a theatre I develop for, a bit like the one in hamilton (if you have ever watched it). I’m trying to make a stage that rotates with one set on the other side. This was a model I found on roblox and it works, but the part doesn’t rotate if it’s anchored and it just blocks the middle part. I was wondering if anyone could help!

This is the script inside the rotating part.

local Steve = game.workspace.Turntable
local ison = false
function switch()
if (ison == false) then
ison = true
Steve.Base.Turn.HingeConstraint.TargetAngle = 180
else
ison = false
Steve.Base.Turn.HingeConstraint.TargetAngle = 0
end
end

script.Parent.ClickDetector.MouseClick:connect(switch)

Thanks :heart:

1 Like

If the stage needs to be anchored, I would recommend using TweenService to turn the stage instead of constraints.

this is what happens : https://gyazo.com/1e212966c256d23fe4f1046979fdd789

I am sorry, my previous reply was incorrect, for some reason tweening the primary part CFrame doesn’t work. I fixed the code using a loop instead:

--Script inside Model 
local TweenService = game:GetService("TweenService")

local Model = script.Parent 

for i, part in pairs(Model:GetDescendants()) do 
	--if its not an actual part, skip it
	if not part:IsA("BasePart") then continue end 
	--I assume you want all the parts to be anchored
	part.Anchored = true 
	--if a primary part isn't set, it becomes the first part it finds
	if not Model.PrimaryPart then 
		Model.PrimaryPart = part 
	end
end

local Part = Model.PrimaryPart
if not Part then warn("Model has no parts!") return end

local angles = Part.CFrame.Rotation

local speed = .1
while task.wait() do 
	Model:SetPrimaryPartCFrame(Part.CFrame*CFrame.Angles(angles.X, angles.Y+speed, angles.Z))
end

oh great that works, how could i make it stop spinning after a couple of seconds?

local speed = .1
local spinning_time = 5

local start = os.time() 
while task.wait() do 
	if os.time()-start > spinning_time then break end
	Model:SetPrimaryPartCFrame(Part.CFrame*CFrame.Angles(angles.X, angles.Y+speed, angles.Z))
end

If the parts on top don’t move, try using BasePart.CustomPhysicalProperties (roblox.com). With a friction of 1 or so.

thanks so much you have helped so much it works!! :slight_smile:

1 Like

Did you originally have your HingeConstraint set to Motor instead of Servo?
Motor will just spin, Servo will rotate it to a certain angle. I did notice that setting it to 180 could cause issues as it would sometimes end up a little off at 0 or 180 and that would cause it to rotate the opposite direction to reach the ‘closest’ 180 degrees.
It looks like your original HingeConstraint was oriented 90 degrees out. If you look at the HingeConstraint in the viewport window and turn on Constraint Details and Draw on Top you should see a brown disk that shows what direction the hinge will rotate on. If it isn’t correct then you need to rotate both Attachments so their Yellow arrow and Orange arrow are aligned the same.

@NyrionDev hey again, i’m a bit confused because i coded a gui for when u press a button it disables the script in the model but even when the script is disabled it keeps spinning i even tried coding it to delete the script but again it keeps on going

That’s because you disable the script using a client script(LocalScript) but the script itself is a server script(the one that rotates the object).