|
| 18 May 2014 08:24 PM |
Function: the script is suppose to play stepping sounds while the player steps. Error: the script only plays the stepping sounds when the player walks once, when it's suppose to loop.
Output: none
Code:
local player = game.Players.LocalPlayer local c = player.Character local h = c.Humanoid
stop = false
h.Running:connect(function(speed) if speed > 0 then repeat script.Step1:play() wait(.25) script.Step2:play() wait(.25) until stop == true else stop = true end end)
|
|
|
| Report Abuse |
|
|
|
| 18 May 2014 08:24 PM |
repeat script.Step1:play() wait(.25) script.Step2:play() wait(.25) until stop == true
This will never end because stop is never being changed to true inside the loop. |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 08:26 PM |
@Sensei
Then how do I make the loop stop when the player stops? |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 08:28 PM |
local player = game.Players.LocalPlayer local c = player.Character local h = c.Humanoid
stop = false
h.Running:connect(function(speed) if speed > 0 then repeat h.Running:connect(function(sped) if sped > 0 then script.Step1:play() wait(.25) script.Step2:play() wait(.25) else stop == true end) until stop == true end end) |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 08:33 PM |
@sensei
had an error, fix it to the code below crashed.
code: local player = game.Players.LocalPlayer local c = player.Character local h = c.Humanoid
stop = false
h.Running:connect(function(speed) if speed > 0 then repeat h.Running:connect(function(sped) if sped > 0 then script.Step1:play() wait(.25) script.Step2:play() wait(.25) else stop = true end end) until stop == true end end) |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 08:38 PM |
local player = game.Players.LocalPlayer local c = player.Character local h = c.Humanoid
stop = false
function runrun(speed) repeat if speed > 0 then script.Step1:play() wait(.25) script.Step2:play() wait(.25) else stop = true end until stop == true end
h.Running:connect(runrun) |
|
|
| Report Abuse |
|
|