What is wrong with my script?
Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
I have my script set up where a loop is resumed when the player is walking and is paused while the player is stopped. When I run the script it runs correctly for the first time, but after that the loop seems to not work. Does anyone know what is wrong with my script?
01 | local Camera = workspace.CurrentCamera |
02 | local Player = game.Players.LocalPlayer |
03 | local Figure = Player.Character |
04 | local Mouse = Player:GetMouse() |
09 | CamMovment = coroutine.create( function () |
17 | Mouse.KeyDown:connect( function (key) |
20 | coroutine.resume(CamMovment) |
24 | Mouse.KeyUp:connect( function (key) |
27 | coroutine.yield(CamMovment) |