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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 05 Aug 2016 |
| Total Posts: 67 |
|
| |
|
| |
|
devKillua
|
  |
| Joined: 05 Aug 2016 |
| Total Posts: 67 |
|
|
| 24 Nov 2017 01:36 AM |
| No, they're in normal scripts |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 24 Nov 2017 01:49 AM |
How is the battery value set?
|
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 05 Aug 2016 |
| Total Posts: 67 |
|
|
| 24 Nov 2017 11:27 AM |
| Bump (someone please halllpppp) |
|
|
| Report Abuse |
|
|