Part Moving up and down but not Spinning at all

So my Problem is, i have a portal, and its already nicely moving up and down, but not Spinning at all. i want to spin the Portal at the same time im moving it up and down.

local part = script.Parent -- is the PrimaryPart in the Portal Model
-- all other parts from the model are weld to the PrimaryPart
part:SetNetworkOwner(nil)
local sp = part.Position + Vector3.new(0, 1, 0)

game:GetService("RunService").Heartbeat:Connect(function(step)
	local so = math.rad(10) * step
	part.CFrame = CFrame.new(sp.X, sp.Y+math.sin(tick()), sp.Z) * CFrame.Angles(so, 0, 0)
end)

I hope someone of you can help me with this Problem bc i dont understand anything anymore… it works with a Tween but if i use Tween and Tween the Orientation of the Primary part the other Parts weird Moving around… yeah they are moving around and that looks like Shit.

Goal: A Nice Portal Moving up and down & Certainly Spinning to the Right. (Cylinder)

1 Like

Can you send a video? All your code looks like it should work. If it’s spinning the wrong direction, try changing which axis you rotate the portal by.

Right now you are rotation on the X-Axis

1 Like

What is the value of step? Try printing variables to see what their values are so you can troubleshoot if the issue is with the numbers there.

game:GetService("RunService").Heartbeat:Connect(function(step)
	local so = math.rad(10) * step
    print("so = ", so, "    step = ", step)
	part.CFrame = CFrame.new(sp.X, sp.Y+math.sin(tick()), sp.Z) * CFrame.Angles(so, 0, 0)
end)
2 Likes

Fixed it.

local sp = part.Position + Vector3.new(0, 1, 0)
local so = 0
game:GetService("RunService").RenderStepped:Connect(function(step)
	so += math.rad(180) * step
	part.CFrame = CFrame.new(sp.X, sp.Y+math.sin(tick()), sp.Z) * CFrame.Angles(so, 0, 0)
end)

the Problem was, i created the Local so value all the time in the loop. so i putted so outside of the loop as a Global value & it got fixed.

but dont think thats the full script ofc its not.

1 Like

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