|
| 21 Aug 2015 10:01 AM |
I'm just learning string patterns so idk if this is right in any way. Script:
local code = script.code script.code.Changed:connect(function() print"processingCode" for w in string.gmatch(code.Value, "%w+") do print(w) if w == "q" or w == "%d" then local sound = Instance.new("Sound", game.Workspace) sound.SoundId = "http://www.roblox.com/asset/?id=152715799" sound.Volume = 15 sound:Play() end if w =="%d" then print"************************************" wait(w * .1) end end end)
Example of a code:0 q 21 q 11 q 11 q 20 q 4 q
Output: processingCode 0 q 21 q 11 q 11 q 20 q 4 q
I just need this to play the sound when it goes over a q, then wait the time * 0.1. Any tips?
|
|
|
| Report Abuse |
|
|
| 21 Aug 2015 10:02 AM |
| doesn't print the asterisks |
|
|
| Report Abuse |
|
|
| 21 Aug 2015 10:18 AM |
Um...what's with the "if w=="%d" then"?
_s = "This is a string. 5"
for pattern_match in string.gmatch(_s,"%d+") do print(pattern_match) end
-->5 |
|
|
| Report Abuse |
|