Hello everyone, I want to make a rotating item UI for my dictionary. Basically, I have 40 items, and I want them to rotate in their respective slots. I know there have been similar topics https://devforum.roblox.com/t/how-do-people-make-3d-models-rotating-in-ui/, but is it possible to do it for more than one item? Thanks for the help!
I think I know what you mean, RennDevv explains it quite well: How to make rotating object in ViewportFrame | Roblox Studio 2022 - YouTube
First of all, parent ur items to a
RunService.RenderStepped and inside the callback function, update the
CFrame property of the object, for eg smth like this shud work.
Item.CFrame = Item.CFrame * CFrame.Angles(0, math.rad(5), 0) * deltaTime
Item is a reference to ur
BasePart item and the rotational speed is determined by the
math.rad(5), which means the object will rotate 5 degrees per frame. And finally the
deltaTime is the parameter provided by the
RenderStepped function, which we multiply for smooth movement.
deltaTime is the seconds it took to go to the current frame from the previous frame. And of you wanna change the speed of the rotation, jus increase/decrease the number inside the
I made the following script:
for count = 1, length(imageID) do local ImageButton = Instance.new("ViewportFrame") ImageButton.Parent = frame ImageButton.Name = "Slot"..count --ImageButton.Image = imageIDTable[count] ImageButton.LayoutOrder = count local clone = game.ReplicatedStorage[CraftableList[count]]:Clone() clone.Parent = ImageButton
It sort of works, but it’s all very off-center. Is there a way I could make it more centered?
RunService.RenderStepped:Connect(function(dt) self.ShopBack.ScrollingFrame.ViewportFrame.Apple.CFrame = self.ShopBack.ScrollingFrame.ViewportFrame.Apple.CFrame * CFrame.Angles(0, math.rad(5), 0) * dt end)