Skip to the content
guardscripts.com Log in
Library

Utility snippets

Short scripts written for this site. Each one is commented so you can change it.

Anti-AFK

written for guardscripts.com

Stops the 20 minute idle kick.

-- Anti-AFK: send a tiny input whenever Roblox says you are idle
local Players = game:GetService('Players')
local VU = game:GetService('VirtualUser')
Players.LocalPlayer.Idled:Connect(function()
  VU:CaptureController()
  VU:ClickButton2(Vector2.new())
end)

Rejoin

written for guardscripts.com

Rejoin the same server.

-- Rejoin the server you are in
local TS = game:GetService('TeleportService')
local P = game:GetService('Players')
if #P:GetPlayers() <= 1 then
  P.LocalPlayer:Kick('Rejoining...')
  task.wait()
  TS:Teleport(game.PlaceId, P.LocalPlayer)
else
  TS:TeleportToPlaceInstance(game.PlaceId, game.JobId, P.LocalPlayer)
end

Server hop

written for guardscripts.com

Join a different, not full server of the same game.

-- Server hop: ask the public servers list, pick one that is not this one and not full
local HS, TS, P = game:GetService('HttpService'), game:GetService('TeleportService'), game:GetService('Players')
local url = 'https://games.roblox.com/v1/games/' .. game.PlaceId .. '/servers/Public?sortOrder=Asc&limit=100'
local ok, res = pcall(function() return HS:JSONDecode(game:HttpGet(url)) end)
if ok and res.data then
  for _, s in ipairs(res.data) do
    if s.id ~= game.JobId and s.playing < s.maxPlayers then
      TS:TeleportToPlaceInstance(game.PlaceId, s.id, P.LocalPlayer)
      break
    end
  end
end

FPS unlock

written for guardscripts.com

Raise the frame cap if your executor supports it.

-- FPS unlock (needs setfpscap from your executor)
if setfpscap then
  setfpscap(240) -- use 0 for no cap
else
  warn('This executor has no setfpscap')
end

Fly (E to toggle)

written for guardscripts.com

Simple fly with WASD, Space and Shift.

-- Fly: press E to toggle, WASD to move, Space up, LeftShift down
local P, UIS, RS = game:GetService('Players'), game:GetService('UserInputService'), game:GetService('RunService')
local plr, cam, on, speed = P.LocalPlayer, workspace.CurrentCamera, false, 60
local conn, bv
local function stop()
  on = false
  if conn then conn:Disconnect() end
  if bv then bv:Destroy() end
end
local function start()
  local hrp = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
  if not hrp then return end
  on = true
  bv = Instance.new('BodyVelocity')
  bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  bv.Parent = hrp
  conn = RS.RenderStepped:Connect(function()
    local d = Vector3.zero
    if UIS:IsKeyDown(Enum.KeyCode.W) then d += cam.CFrame.LookVector end
    if UIS:IsKeyDown(Enum.KeyCode.S) then d -= cam.CFrame.LookVector end
    if UIS:IsKeyDown(Enum.KeyCode.A) then d -= cam.CFrame.RightVector end
    if UIS:IsKeyDown(Enum.KeyCode.D) then d += cam.CFrame.RightVector end
    if UIS:IsKeyDown(Enum.KeyCode.Space) then d += Vector3.yAxis end
    if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then d -= Vector3.yAxis end
    bv.Velocity = d * speed
  end)
end
UIS.InputBegan:Connect(function(i, gp)
  if gp or i.KeyCode ~= Enum.KeyCode.E then return end
  if on then stop() else start() end
end)

Noclip

written for guardscripts.com

Walk through walls until you reset.

-- Noclip: turn collisions off for your character every frame
local P, RS = game:GetService('Players'), game:GetService('RunService')
RS.Stepped:Connect(function()
  local c = P.LocalPlayer.Character
  if not c then return end
  for _, part in ipairs(c:GetDescendants()) do
    if part:IsA('BasePart') then part.CanCollide = false end
  end
end)

Teleport to a player

written for guardscripts.com

Jump to a player by part of their name.

-- Teleport to a player: change NAME (part of the name is enough)
local NAME = 'friend'
local P = game:GetService('Players')
for _, p in ipairs(P:GetPlayers()) do
  if p ~= P.LocalPlayer and p.Name:lower():find(NAME:lower(), 1, true) then
    local me = P.LocalPlayer.Character and P.LocalPlayer.Character:FindFirstChild('HumanoidRootPart')
    local to = p.Character and p.Character:FindFirstChild('HumanoidRootPart')
    if me and to then me.CFrame = to.CFrame * CFrame.new(0, 0, 3) end
    break
  end
end

ESP outline

written for guardscripts.com

Outline every other player through walls.

-- ESP: a Highlight on every other player's character
local P = game:GetService('Players')
local function add(p)
  if p == P.LocalPlayer then return end
  local function on(c)
    local h = Instance.new('Highlight')
    h.FillTransparency = 1
    h.OutlineColor = Color3.fromRGB(60, 210, 255)
    h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    h.Parent = c
  end
  if p.Character then on(p.Character) end
  p.CharacterAdded:Connect(on)
end
for _, p in ipairs(P:GetPlayers()) do add(p) end
P.PlayerAdded:Connect(add)

Infinite jump

written for guardscripts.com

Jump again in the air.

-- Infinite jump
local UIS, P = game:GetService('UserInputService'), game:GetService('Players')
UIS.JumpRequest:Connect(function()
  local h = P.LocalPlayer.Character and P.LocalPlayer.Character:FindFirstChildOfClass('Humanoid')
  if h then h:ChangeState(Enum.HumanoidStateType.Jumping) end
end)

Walk speed and jump power

written for guardscripts.com

Change your speed that sticks after you respawn.

-- Walk speed and jump power, re-applied after every respawn
local P = game:GetService('Players')
local SPEED, JUMP = 32, 70
local function apply(c)
  local h = c:WaitForChild('Humanoid')
  h.WalkSpeed = SPEED
  h.UseJumpPower = true
  h.JumpPower = JUMP
end
if P.LocalPlayer.Character then apply(P.LocalPlayer.Character) end
P.LocalPlayer.CharacterAdded:Connect(apply)

Fullbright

written for guardscripts.com

Remove darkness and fog.

-- Fullbright
local L = game:GetService('Lighting')
L.Brightness = 2
L.ClockTime = 14
L.FogEnd = 1e6
L.GlobalShadows = false
L.Ambient = Color3.new(1, 1, 1)

Copy my position

written for guardscripts.com

Copy your CFrame to the clipboard (needs setclipboard).

-- Copy my position as a CFrame line
local c = game:GetService('Players').LocalPlayer.Character
local hrp = c and c:FindFirstChild('HumanoidRootPart')
if hrp and setclipboard then
  setclipboard('CFrame.new(' .. tostring(hrp.Position) .. ')')
end
UpDown moveEnter open> commandsEsc close