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 » Scripters
Home Search
 

Re: Need help urgently.

Previous Thread :: Next Thread 
T_ry is not online. T_ry
Joined: 04 Jul 2012
Total Posts: 230
13 Sep 2016 06:38 AM
So I'm working on making a case opening type of thing, so far it works fine and spins randomly. But when it gets to a certain point, it doesn't re-loop around. This is what my script looks like:


wait(2)

local i = 0

while i < math.random(50,100) do
script.Parent.Position = script.Parent.Position + UDim2.new(0.01,0,0,0)
i = i + 1
wait(0.01)
if script.Parent.Position == UDim2.new(1.7,0,0,0) then

print('good succ')
end




end









Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
13 Sep 2016 06:41 AM
When it gets to 98 there are almost no chances that it'll work
Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
13 Sep 2016 06:42 AM
The simplest fix would be to reset the i to 0 when it gets to a high value
if i>80 then i=0 end
But the script is kinda weird by itself.
Report Abuse
T_ry is not online. T_ry
Joined: 04 Jul 2012
Total Posts: 230
13 Sep 2016 06:43 AM
@noone what do you mean by that?


Report Abuse
mooing is not online. mooing
Joined: 28 Apr 2009
Total Posts: 79
13 Sep 2016 07:23 AM
#o#I#m#w#r#i#g#o# #a#i#g#a#c#s# #p#n#n# #y#e#o# #h#n#,#s# #a# #t#w#r#s#f#n# #n# #p#n# #a#d#m#y# #u# #h#n#i# #e#s#t# # #e#t#i# #o#n#,#i# #o#s#'# #e#l#o# #r#u#d# #h#s#i# #h#t#m# #c#i#t#l#o#s#l#k#:


w#i#(#)

#o#a# # # #

w#i#e#i#<#m#t#.#a#d#m#5#,#0#)#d#
#c#i#t#P#r#n#.#o#i#i#n#=#s#r#p#.#a#e#t#P#s#t#o# # #D#m#.#e#(#.#1#0#0#0#
# # # # #
#a#t#0#0#)
i# #c#i#t#P#r#n#.#o#i#i#n#=# #D#m#.#e#(#.#,#,#,#)#t#e#

p#i#t#'#o#d#s#c#'#
#n#




#n#










Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
13 Sep 2016 12:14 PM
It doesn't reloop because i is always being increases by 1, and since the math.random is always between 50 and 100, there is no logical way it'll work when i gets to 100. And even then you have only 1 in 100 chances of getting to 100.
Report Abuse
T_ry is not online. T_ry
Joined: 04 Jul 2012
Total Posts: 230
13 Sep 2016 12:14 PM
@noone it doesn't matter, thanks for your input/help but I've found a more efficient way of performing this.


Report Abuse
Haukly is online. Haukly
Joined: 15 Apr 2012
Total Posts: 1728
13 Sep 2016 12:54 PM
@T_ try this:



local i = 0
wait(1.5)
while i < math.random(50,150) do
script.Parent.Position = script.Parent.Position + UDim2.new(0.02,0,0,0)
wait(0.01)
i = i + 1
wait(0.01)
if script.Parent.Position == UDim2.new(1.7,0,0,0) then

print('Ihopeitworked')
end
end

If this doesnt work I`ll try to make the full script new for you.


Report Abuse
nooneisback is not online. nooneisback
Joined: 28 Feb 2012
Total Posts: 1672
13 Sep 2016 12:56 PM
He already made a new one
Report Abuse
Haukly is online. Haukly
Joined: 15 Apr 2012
Total Posts: 1728
13 Sep 2016 12:57 PM
Oh, sorry. But I think mine would have maybe worked. But not in FE.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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