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: Loops and Values

Previous Thread :: Next Thread 
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
23 Nov 2017 10:36 PM
So for this code Im trying to make a sound play when it under 98 but its not working can you tell me whats wrong and for the other

while true do
if script.Parent.Parent.Click.Switch.Battery.Value <= 98 then
script.Parent.Sound:Play()
end
wait(script.Parent.Sound.TimeLength)
end


Which is this Im trying to make it stop at a certain point but I forgot how to do that, any help would be appreciated, please and thanks.

while true do
if script.Parent.Parent.Click.Switch.Battery.Value <= 100 then
for i = 1, 3 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new( -0.25, 0, 0)
wait()
end
elseif script.Parent.Parent.Click.Switch.Battery.Value >= 100 then
for i = 1, 3 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0.25, 0, 0)
wait()
end
elseif script.Parent.Parent.Click.Switch.Battery.Value == 100 then
break
elseif script.Parent.Parent.Click.Switch.Battery.Value == 0 then
break
end
wait(1)
end
Report Abuse
AsharKYT is online. AsharKYT
Joined: 18 Jun 2017
Total Posts: 174
23 Nov 2017 10:46 PM
It will not break because it's a else if statement. Change the break part into its own if statement then it should work.
Report Abuse
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
24 Nov 2017 12:13 AM
Alright hopefully it worked but what Im trying to do is for the part thats moving to have a limit until it stops when it gets to a certain point such as when the value is 0 the part will stop somewhere below and when the value is 100 it will stop growing, this will explain

https://www.roblox.com/games/1172320198/devKilluas-Place-Number-29
Report Abuse
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
24 Nov 2017 12:18 AM
booomp
Report Abuse
PuffoThePufferfish is online. PuffoThePufferfish
Joined: 19 Jan 2013
Total Posts: 362
24 Nov 2017 01:15 AM
is it in a Local Script?


Report Abuse
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
24 Nov 2017 01:36 AM
No, they're in normal scripts
Report Abuse
PuffoThePufferfish is online. PuffoThePufferfish
Joined: 19 Jan 2013
Total Posts: 362
24 Nov 2017 01:46 AM
Are you sure the problem is in the looping, it appears to be working just fine in the game


Report Abuse
PuffoThePufferfish is online. PuffoThePufferfish
Joined: 19 Jan 2013
Total Posts: 362
24 Nov 2017 01:49 AM
How is the battery value set?


Report Abuse
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
24 Nov 2017 10:38 AM
No it doesn't in the game it just moves down and when I press the switch it doesn't go up. Its an int value so if the battery is 100 then the the brick will stay at the top, if the battery is at 0 then it wont move any further because its already at the bottom. It's hard to explain when roblox doesn't let you paste ##### or stuff.
Report Abuse
devKillua is not online. devKillua
Joined: 05 Aug 2016
Total Posts: 67
24 Nov 2017 11:27 AM
Bump (someone please halllpppp)
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