how do i make a loop script where i can enable and disable the loop from gui buttons?
--LocalScript local wfc=game.WaitForChild local re=wfc(game:GetService("ReplicatedStorage"),"RemoteEvent") local button --TheButtonYourPressing button.MouseButton1Click:Connect(function() re:FireServer("toggle") end) --ServerScript local wfc=game.WaitForChild local var=false local re=wfc(game:GetService("ReplicatedStorage"),"RemoteEvent") re.OnServerEvent:Connect(function(plr,func,...) local args={...} if func=="toggle" then var=not var end end) while var do wait() --Do Whatever you want the loop to do. end