Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help on my Xp bar script!? (2 line script) Please

Asked by 9 years ago

This is in a xp.Changed function. I have tried a few different ways but none of them work the way I want them too.

bob = 1/(xpneeded-xpgained)
bar.Size = UDim2.new(bob,0,0,0)

Want I am trying to do: xp bar is increased by a steady % depending the the xpgained. I said steady because in one of my failed attempts it doubled the intervals in the xp bar everytime xp was gained.

Please if you have experience with xp bars or think you know a good way I am able to do this cause you're better at maths and logic than me please give it a go. The place I am making this for is my Nature game.

1 answer

Log in to vote
0
Answered by
KarlXYZ 120
9 years ago

Try this:

bob = 1*(xpneeded/xpgained)
bar.Size = UDIm2.new(bob,0,0,0)

If you're going to keep using the x scale value of UDim2, you can remove the "1*" too.

bob = xpneeded/xpgained
bar.Size = UDIm2.new(bob,0,0,0)

Also, make sure you have something in the y scale or y offset values for the size or you won't see any xp bar at all.

For a smoother effect, you may want to experiment with Tweening too.

0
Haha... In one of my previous versions I made it + the UDim2 value... Forgot to change that, thanks. 1234Christopher 10 — 9y
0
However my equation doesn't work, know a better one? 1234Christopher 10 — 9y
0
Have you included a y offset or y scale value in the UDim2? That's if the bar isn't showing up. KarlXYZ 120 — 9y
Ad

Answer this question