I want to loop my script so that two function I activate with a key on my keyboard can loop after they finish happening.
The issue is I haven’t used loops before and my attempts result in errors in my script. I’m not sure what to do to create the loop.
The solutions I have tried are to add “while true do” before my first function but it did not work.
Player = game.Players.LocalPlayer
a = script.Parent.Parent.Admins
Admins = {a.User1.Value,a.User2.Value,a.User3.Value,a.User4.Value,a.User5.Value}
for i,v in pairs (Admins) do
if Player.Name == v then
mouse = Player:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "k" then
game.Workspace.KDHandler1.MoveTest:InvokeServer() --first function
wait(1)
game.Workspace.KDHandler1.MoveTest2:InvokeServer() ---second function
end
end)
end
end
Am I supposed to use “while true do” at all? If not what am I doing wrong?