So I'm basically trying to make this CS:GO like case opener, except with pointshop items. What I'm trying to do is make the pictures slide horizontally, but the pictures are going crazy (glitching around)
The sliding code:
[CODE]
for i = 0, 2 do
Labels[ i + 1 ] = vgui.Create( "DImage", SlotConstraint )
Labels[ i + 1 ]:SetPos( -15 + i * 130, 30 )
Labels[ i + 1 ].pos = { x = 5 + i * 130, y = 30 }
Labels[ i + 1 ]:SetImage("scripted/breen_fakemonitor_1")
//Labels[ i + 1 ]:SetText( "0" )
Labels[ i + 1 ]:SizeToContents()
Labels[ i + 1 ].Think = function()
if( LocalPlayer():GetNWBool( "Slots" ) ) then
local pos = Labels[ i + 1 ].pos
Labels[ i + 1 ]:SetPos( pos.y, pos.x, pos.z )
Labels[ i + 1 ].pos = { x = pos.x, y = pos.y + 20 }
if( pos.y > 100 ) then
Labels[ i + 1 ]:SetPos( pos.y, -50 )
//Labels[ i + 1 ]:SetText( tostring( math.random( 1, 9 ) ) )
Labels[ i + 1 ].pos = { x = pos.x, y = -50 }
end
end
end
end
[/CODE]
Any help is appreciated.
Edit: Here's a GIF of what's happening:
[URL="http://recordit.co/ySm1yBvOot"]http://recordit.co/ySm1yBvOot[/URL]
Edit2:
Alright, so i fixed the glitching. Now it's just resetting to it's original position: [url]http://recordit.co/rJYPAdW6Fc[/url] Why is it doing that?
Sorry, you need to Log In to post a reply to this thread.