xXMADEXx Posted May 11, 2013 Share Posted May 11, 2013 Hello guys, im trying to make a moving GUI, with onClientRender, but I have one prob. It moves to slow if I do the Y + 1, but that is the only one that will work. How can i make it so I can do something like Y + 10, and it will stop in the center? Code: bindKey("M","down", function () addEventHandler("onClientRender", root, moveGUI) end ) function moveGUI() local x, y = guiGetPosition(window, false) if (y ~= (ry/2-334/2)) then -- If its not the center guiSetPosition(window, x, y + 1, false) -- Too slow else removeEventHandler("onClientRender", root, moveGUI) end end Link to comment
Guest Guest4401 Posted May 11, 2013 Share Posted May 11, 2013 bindKey("M","down", function () addEventHandler("onClientRender", root, moveGUI) end ) function moveGUI() local x, y = guiGetPosition(window, false) if (y+10) < (ry/2-334/2) then guiSetPosition(window, x, y + 10, false) else guiSetPosition(window, x, ry/2-334/2, false) removeEventHandler("onClientRender", root, moveGUI) end end Link to comment
xXMADEXx Posted May 11, 2013 Author Share Posted May 11, 2013 Wow, it actually worked! Thank you very much I cannot believe i didn't catch that, lol. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now