generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Y this no round up?

Previous Thread :: Next Thread 
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 05:20 PM
    for i = 0, 100 do
    script.Parent.Frame.Size = UDim2.new(0, math.ceil(i), 0, 50)
    wait(math.random(1))
    end

math.ceil is supposed to round up, but it doesn't seem to be working. I wouldn't have to be using it if the for loop didn't give me whole numbers... Help?

† KMXD †
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
22 Aug 2012 05:23 PM
for i = 0, 100, .5 do
script.Parent.Frame.Size = UDim2.new(0, math.ceil(i), 0, 50)
wait(math.random(1))
end

Θ_Θ Sage Mode!
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
22 Aug 2012 05:28 PM
Do you want it to round up,
or to the nearest integer?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 05:31 PM
No dice, Des.

@Dark

It doesn't matter, nearest integer, rounds up, rounds down, as long as it's close and not a decimal...

† KMXD †
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
22 Aug 2012 05:32 PM
The "i" is already a whole number.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 05:35 PM
It's supposed to be, but it's not giving me whole numbers.

† KMXD †
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
22 Aug 2012 05:37 PM
for i = 0, 200, 2 do
script.Parent.Frame.Size = UDim2.new(0, math.ceil(i), 0, 50)
wait(math.random(1))
end

Maybe that'll fix??

Θ_Θ Sage Mode!
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 05:40 PM
nope

† KMXD †
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
22 Aug 2012 05:44 PM
for i = 0, 100 do
script.Parent.Frame.Size = UDim2.new(0, math.ceil(i), 0, 50)
print(script.Parent.Frame.Size)
wait(math.random(1))
end

Run this, give us the output.
Report Abuse
StygianBlade is not online. StygianBlade
Joined: 15 Sep 2011
Total Posts: 426
22 Aug 2012 05:46 PM
Remove the math.ceil? Its working for me fine:

local f = Instance.new("Frame")

for i = 0, 100 do
f.Size = UDim2.new(0, i, 0, 50)
print(f.Size.X.Offset)
end

f = f:Destroy()

Command Bar -
local f = Instance.new("Frame") for i = 0, 100 do f.Size = UDim2.new(0, i, 0, 50) print(f.Size.X.Offset) end f = f:Destroy()
Report Abuse
StygianBlade is not online. StygianBlade
Joined: 15 Sep 2011
Total Posts: 426
22 Aug 2012 05:49 PM
@Destro;

Funny sig ^.^

@awesum;

Unlike CFrames and vectors calling print on a UDim class would just return a userdata
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
22 Aug 2012 05:51 PM
I'm naruto fan :P, new episode is out today, time to watch :D

Θ_Θ Sage Mode!
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 05:52 PM
@aw

userdata: 179EB070
userdata: 17BDF5E0
userdata: 17BDFA30
userdata: 17BDFC70
...
And so forth.


@Styg

1
2
3
4
5
...

But it still shows decimals in the text.


† KMXD †
Report Abuse
StygianBlade is not online. StygianBlade
Joined: 15 Sep 2011
Total Posts: 426
22 Aug 2012 06:00 PM
@Knight What text?

@Destro
Me too :P I'm just sad we have to wait a full week for a new episode, especially now that the war is getting exciting
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 06:01 PM
I can never keep up with the episodes, I have the newest game at least :P

But ANYWAYS. I found the problem. I accidentally posted the wrong script, and now I just have to use math.ceil on another part. Thanks for the help, all!

† KMXD †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Aug 2012 06:03 PM
Yup, works perfectly now. Thanks again, guys.

† KMXD †
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image