Making a sliding case opening animation

I’m trying to make this slide smoothly, but for some reason everything becomes chaos after a while of the wheel spinning. Here’s the script and a video of what’s happening:

	local speed = 20
	local subtractionMultiplier = 1
	while speed > 0 do
		speed -= (0.05 * subtractionMultiplier)
		subtractionMultiplier += 0.006
		for _, template in pairs(caseOpeningFrame:GetChildren()) do
			if template:IsA("Frame") then
				template.Position =, template.Position.X.Offset + speed, 0, 0)
				if template.Position.X.Offset >= 500 then
					local temp = CreateRandomTemplate(caseInfo)
				        temp.Position =, (lastCreated.Position.X.Offset - 100), 0, 0)
					temp.Parent = caseOpeningFrame
					lastCreated = temp

As you can see, it’s not smooth at all. I know how to fix the problem with the images not generating quickly enough, but I can’t seem to fix the frames slowly spacing out / overlapping.

Does anybody know how to fix this? Thanks in advance.

You shouldn’t be generating the images while the animation is running. I would generate all the images before you even show the GUI, and then cycle through them when the animation runs.

1 Like

Yes I realize that, but what I’m trying to fix is the choppy movement / frames eventually spacing out and overlapping eachother.

I solved the problem, though it won’t let me delete the topic.

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