Script wont do the same with the other instance

I am making a gif system with MANY gifs like 10 or 20 and gif system requires loops which causes lag so I made a system that overcomes it using 1 loop but it only works for the first gif and not for the others. I used this guys gif system and edited it to cause less lag as I said and doesn’t work. Here is the script

local warperFramerate = 12
local t = tick()

local function Update()
	for i,v in pairs(script.Parent:GetDescendants()) do
		if v:FindFirstChild("Columns") then
			local columns,rows,frames = v.Columns.Value,v.Rows.Value,v.Frames.Value
	--		print(columns,rows,frames)
			local lastFrame = v.LastFrame
			v.Size = UDim2.new(columns,0,rows,0)
			if tick()-t >= 1/warperFramerate then
				print(v.Name)
				if lastFrame.Value > frames then lastFrame.Value = 1 end
				local CurrentColumn = lastFrame.Value
				local CurrentRow = 1
				repeat
					if CurrentColumn > columns then
						CurrentColumn = CurrentColumn - columns
						CurrentRow = CurrentRow + 1
					end
				until not(CurrentColumn > columns)
				local pos = UDim2.new(-(CurrentColumn-1),0,-(CurrentRow-1),0)
				v.Position = pos
				t = tick()
				lastFrame.Value += 1
			end
		end
	end
end

while true do
	Update()
	task.wait()
end

Heres a image
image
the top 1 works the bottom 1 doesn’t.

2 Likes

Can you show a snap shot of your workspace. Its probably cause the script is only parented in the first one

Nope its not its parented to the parent of both frames.

Send a snapshot of workspace. You code logic seems fine

image

The script stops because of tast.wait just use

 coroutine.wrap(function()
    Update()
    task.wait()
 end)()
1 Like

Ow wait i was wrong i guess

wait so thats not the solution? i think its with the for i,v loop

You have to frames called Warper, however they are not the same one. Move Animated0 to the top Warper frame, and it should work!

wai wat? explain more…

Nvm, looks like it doesn’t matter in the end

then why it occur? : (

add

print(v.Name)

after v:FindFirstChild("Columns")
run it for 5 seconds and take a snap shot of the output. i think i figured it out. And hurry cause i’m about to g o to sleep

your sleep can wait
ok wait a sec

image
displays both as expected.

yeah just as i suspected. your code works it just has bad math. triple check the numbers.

no not at all that statement is not true. Its numbers are fine

Solution: Remove the if statement here
image
thank you everyone for helping.