Im making a anti afk script for my game so players dont get kicked it works and all but why does it read from top to bottom?
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local on = true script.Parent.MouseButton1Click:Connect(function() if on == true then repeat print("I am on") wait(2) local part2 = Instance.new("Part", workspace) part2.CanCollide = false part2.Anchored = true part2.Transparency = 1 part2:PivotTo(character:WaitForChild("Head"):GetPivot() * CFrame.new(0, 0, 20)) part2.Name = "Part1" character:WaitForChild("Humanoid"):MoveTo(part2.Position, part2) until on == false end end) script.Parent.Parent.stop.MouseButton1Click:Connect(function() on = false print("Off") end) script.Parent.MouseButton1Click:Connect(function() on = true print("On") end)