0% found this document useful (0 votes)
56 views4 pages

Lock On and TP Behind

The document is a Lua script for a Roblox game that implements a user interface for a 'Lock-On' feature, allowing players to select targets and toggle various functionalities like 'BehindU' for teleportation. It creates a draggable GUI with buttons for locking on to players and enabling/disabling features, while also handling camera adjustments based on the selected target. Additionally, it includes a teleportation feature activated by holding the Left Control key and clicking with the mouse.

Uploaded by

aklinwert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views4 pages

Lock On and TP Behind

The document is a Lua script for a Roblox game that implements a user interface for a 'Lock-On' feature, allowing players to select targets and toggle various functionalities like 'BehindU' for teleportation. It creates a draggable GUI with buttons for locking on to players and enabling/disabling features, while also handling camera adjustments based on the selected target. Additionally, it includes a teleportation feature activated by holding the Left Control key and clicking with the mouse.

Uploaded by

aklinwert
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

local Players = game:GetService("Players")

local RunService = game:GetService("RunService")


local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- COLORS
local indigo/blue = Color3.fromRGB(75, 0, 130)
local periwinkle = Color3.fromRGB(204, 204, 255)

-- STATE
local lockedTarget = nil
local lockOnActive = false
local behindUEnabled = false

--utilities
local function roundify(obj, rad)
local uicorner = Instance.new("UICorner", obj)
uicorner.CornerRadius = UDim.new(0, rad)
end

local function getCharRoot(plr)


if plr and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")
then
return plr.Character.HumanoidRootPart
end
end

-- uui (TO PlayerGui)


local gui = Instance.new("ScreenGui")
gui.Name = "JumpShowdownLockOnUI"
gui.Parent = LocalPlayer:WaitForChild("PlayerGui")

local frame = Instance.new("Frame", gui)


frame.Size = UDim2.new(0, 340, 0, 420)
frame.Position = UDim2.new(0.5, -170, 0.5, -210)
frame.BackgroundColor3 = indigo
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
roundify(frame, 16)

local title = Instance.new("TextLabel", frame)


title.Size = UDim2.new(1, 0, 0, 44)
title.Position = UDim2.new(0, 0, 0, 0)
title.BackgroundTransparency = 1
title.Text = "Jump Showdown Lock-On"
title.TextColor3 = periwinkle
title.Font = Enum.Font.SourceSansBold
title.TextSize = 28

local line = Instance.new("Frame", frame)


line.Size = UDim2.new(1, -32, 0, 2)
line.Position = UDim2.new(0, 16, 0, 44)
line.BackgroundColor3 = periwinkle
line.BorderSizePixel = 0

local targetList = Instance.new("ScrollingFrame", frame)


targetList.Size = UDim2.new(1, -32, 0, 140)
targetList.Position = UDim2.new(0, 16, 0, 56)
targetList.BackgroundColor3 = indigo
targetList.BorderSizePixel = 0
targetList.CanvasSize = UDim2.new(0, 0, 0, 0)
targetList.ScrollBarThickness = 6
roundify(targetList, 12)

local function refreshTargetList()


targetList:ClearAllChildren()
local y = 0
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer then
local btn = Instance.new("TextButton", targetList)
btn.Size = UDim2.new(1, 0, 0, 32)
btn.Position = UDim2.new(0, 0, 0, y)
btn.BackgroundColor3 = periwinkle
btn.TextColor3 = indigo
btn.Font = Enum.Font.SourceSans
btn.TextSize = 20
btn.TextXAlignment = Enum.TextXAlignment.Left
btn.Text = string.format("%s [%s]", player.DisplayName or
player.Name, player.Name)
roundify(btn, 8)
btn.MouseButton1Click:Connect(function()
lockedTarget = player
end)
y = y + 36
end
end
targetList.CanvasSize = UDim2.new(0, 0, 0, y)
end
Players.PlayerAdded:Connect(refreshTargetList)
Players.PlayerRemoving:Connect(refreshTargetList)
refreshTargetList()

local lockOnBtn = Instance.new("TextButton", frame)


lockOnBtn.Size = UDim2.new(1, -32, 0, 40)
lockOnBtn.Position = UDim2.new(0, 16, 0, 210)
lockOnBtn.BackgroundColor3 = periwinkle
lockOnBtn.TextColor3 = indigo
lockOnBtn.Font = Enum.Font.SourceSansBold
lockOnBtn.TextSize = 22
lockOnBtn.Text = "Lock-On: OFF"
roundify(lockOnBtn, 12)

lockOnBtn.MouseButton1Click:Connect(function()
lockOnActive = not lockOnActive
lockOnBtn.Text = "Lock-On: " .. (lockOnActive and "ON" or "OFF")
end)

local behindUBtn = Instance.new("TextButton", frame)


behindUBtn.Size = UDim2.new(1, -32, 0, 40)
behindUBtn.Position = UDim2.new(0, 16, 0, 260)
behindUBtn.BackgroundColor3 = periwinkle
behindUBtn.TextColor3 = indigo
behindUBtn.Font = Enum.Font.SourceSansBold
behindUBtn.TextSize = 22
behindUBtn.Text = "BehindU: OFF"
roundify(behindUBtn, 12)

behindUBtn.MouseButton1Click:Connect(function()
behindUEnabled = not behindUEnabled
behindUBtn.Text = "BehindU: " .. (behindUEnabled and "ON" or "OFF")
end)

local info = Instance.new("TextLabel", frame)


info.Size = UDim2.new(1, -32, 0, 44)
info.Position = UDim2.new(0, 16, 1, -54)
info.BackgroundTransparency = 1
info.TextColor3 = periwinkle
info.Font = Enum.Font.SourceSans
info.TextSize = 18
info.Text = "Select a player to lock-on.\nToggle BehindU to autofarm.\nHold
LeftCtrl & LeftClick to teleport."

-- CAMERA & BEHINDU LOGIC


RunService.RenderStepped:Connect(function()
local myRoot = getCharRoot(LocalPlayer)
local targetRoot = lockedTarget and getCharRoot(lockedTarget)

if behindUEnabled and targetRoot and myRoot then


-- Teleport behind target
local offset = targetRoot.CFrame.LookVector * -2
local newPos = targetRoot.Position + offset + Vector3.new(0,1,0)
myRoot.CFrame = CFrame.new(newPos, targetRoot.Position)
Camera.CameraType = Enum.CameraType.Custom
elseif lockOnActive and targetRoot and myRoot then
-- Aim-assist lock-on camera (smoothly look at target)
local cameraOffset = Vector3.new(0, 4, -8)
local desiredPos = myRoot.Position + cameraOffset
local lookAt = targetRoot.Position + Vector3.new(0,2,0)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera.CFrame:Lerp(CFrame.new(desiredPos, lookAt), 0.35)
else
Camera.CameraType = Enum.CameraType.Custom
end
end)

-- CLICK TO TELEPORT FEATURE (LeftCtrl + LeftClick)


local Mouse = LocalPlayer:GetMouse()
local ctrlHeld = false

UserInputService.InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.LeftControl then
ctrlHeld = true
end
end)
UserInputService.InputEnded:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.LeftControl then
ctrlHeld = false
end
end)

Mouse.Button1Down:Connect(function()
if ctrlHeld and LocalPlayer.Character and
LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
local target = Mouse.Hit
if target then
-- Teleport slightly above the clicked spot to avoid falling through
the floor
LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(target.p +
Vector3.new(0,3,0))
end
end
end)

You might also like