Im trying to make the three lower crystals revolve about the center, while at the same time tweening them, sort of like a rocking back and forth motion
For some reason this just refuses to work, when i run it they revolve but they do not tween. I have print statements in my script and they say that the tweens should be running, but there are no errors, they just dont run. If it helps, I made them revolve using Cylindrical Constraints, this is the setup in explorer
I want to know if it is possible to have these crystals rock back and forth with tweens while also having them revolve. I cant simply change their orientation, i need tweens to get the easing effect.
I can delete one of the movements (tweening or revolving) but its always just one or the other, not both
Not really relevant, but why are you using CylindricalConstraints for rotation and not HingeConstraints?
So why use a Local script?
Since this is the Scripting support forum you should probably copy/paste your script here so we can see what’s going on. Remember to put 3 backticks (```) before and after the script so it formats properly here.
I don’t know, I just searched up how to revolve something and the first result was cylindrical constraints, it works so i just used that, if hinges work better i can switch to that
Ill change it to a server script once i get it working, unless that affects if it works or not, then ill change it
Heres my “revolve” script:
local tweenService = game:GetService("TweenService")
local forwardTweens = {}
local backwardTweens = {}
while true do
task.wait(0.01)
for _, crystal in ipairs(script.Parent:GetChildren()) do
if crystal:IsA("UnionOperation") then
tween1 = tweenService:Create(
crystal,
TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
{CFrame = crystal.CFrame * CFrame.Angles(math.rad(-47), 0, 0)}
)
tween2 = tweenService:Create(
crystal,
TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
{CFrame = crystal.CFrame}
)
table.insert(forwardTweens, tween1)
table.insert(backwardTweens, tween2)
end
print("Tweens created")
end
for _, tween in ipairs(forwardTweens) do
tween:Play()
print("Tween1 played")
end
forwardTweens[1].Completed:Wait()
for _, tween in ipairs(backwardTweens) do
tween:Play()
print("Tween2 played")
end
backwardTweens[1].Completed:Wait()
forwardTweens = {}
backwardTweens = {}
end```
So as the link I posted said, the first tween will overwrite the second one.
Also, you aren’t using the Constraints anywhere in the script.
Constraints can’t be used to rotate Anchored Parts.
Why not Tween the Orientation of the whole assembly, then just weld the crystals to the center and tween the rocking motion of the crystals by changing the angle of the C0 or C1 of the weld.
Ive done some experimenting. Ive welded the crystals to a center part like you said and made them revolve on the axis of the center part, which ive done through changing the c frame of the center (thus also moving the crystals). the problem is i dont know the correct way to set this up. The center must be anchored or it will fall. If i dont anchor the crystals, they will revolve about the center but wont tween. If i do anchor them, they tween but dont revolve. How can i work around this?
If it helps, this is the script i used to make them revolve, its in the same place as the first script i showed (they are separated into 2 server scripts, one for the tweens one for the revolution)
local axis = script.Parent
while true do
task.wait(0.001)
axis.CFrame *= CFrame.Angles(0, 0.01, 0)
end
Have you just tried revolving the center with a HingeConstraint set to Motor attached to an anchored Part, then using 3 HingeConstraints set to servo for the crystals so they can be rocked back and forth, or set them to Motor to spin them around completely?
I dont entirely understand what you mean, do you want me to use hinge constraints on the crystals instead of tweens? if so i cant do that because as far as im aware hinge constraints wont give me the easing motions like tweens do