I coded a part that rotates and levitates. For some reason when I use weld constraints the parts just stay in place instead of moving with the part they’re welded to.
Video:
The parts are unanchored and CanCollide Off. The part they’re welded to is Anchored.
In the weld constraint I have Part1 as the part and Part0 as the part being welded to.
Code (parented to the part everything is welded to) :
local part = script.Parent
local amplitude = 1.5 -- offset on both sides
local magnitude = 2.5 -- time it takes to move from the bottom -> top, and top -> bottom
local defaultCFrame = part.Position
--// Float
game:GetService("RunService").Stepped:Connect(function()
part.Position = defaultCFrame + Vector3.new(0, amplitude*math.sin(tick()*math.pi/magnitude), 0)
end)
--// Rotate
local PartSpeed = 0.05
local Part = script.Parent
local incr = 360/160
while wait() do
for deg = 0, 360, incr do
part.Rotation = Vector3.new(deg, deg, 0)
wait()
end
end