so i am working on a super simple fishing system, and thanks to Ryzox i have a working script that gives gold when i click a brick, then i added in a repeat and stopped you from being able to click it while the repeat is running, but im needing it to stop the repeat when wsad or space is pressed.
but ive got no clue how to do this >>....yes im very noob at Lua, wrote my first line of Lua a few days ago :p soooooo
heres the script i have
Enabled = false
script.Parent.ClickDetector.MouseClick:connect(function(player)
if Enabled == false then
Enabled = true
local Leaderstats = player:findFirstChild("leaderstats")
if Leaderstats:findFirstChild("Gold") then
repeat
Leaderstats.Gold.Value = Leaderstats.Gold.Value + 10
wait(.5)
until Leaderstats.Gold.Value == 100
Enabled = false
end
end
end)
what line would i add to stop the repeat when w/e key is pressed?

4 comments
Well i'm not sure what you're trying to do here and by the looks of it you are already stopping the loop once the gold = 100 so what are you trying to do with keys?
Try using this http://wiki.roblox.com/index.php?title=API:Class/Mouse/KeyDown
Look up KeyDown events and stuff, posted above bby RRCTrooper. Create a variable that tells the repeat loop whether or not it can run. repeat if VALUE then STUFF end until CONDITION
hehe thanks guys, and yex ryzox i had the gold = 100 as a place holder so it wouldn't be an endless loop :P