Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local camera = workspace.CurrentCamera
- local playerGui = player:WaitForChild("PlayerGui")
- local smoothSpeed = 0.9
- local horizontalPrediction = 0.0346 -- Horizontal prediction value
- local verticalPrediction = 0.0538528682685329 -- Vertical prediction value
- local xOffset, yOffset, zOffset = 0.0346, 0.0346, 0.0346 -- All offsets set to 0.0346
- local isLockedOn = false
- local lockedPlayer = nil
- local function enhancedPrediction(targetPlayer)
- if targetPlayer and targetPlayer.Character then
- local humanoidRootPart = targetPlayer.Character:FindFirstChild("HumanoidRootPart")
- local head = targetPlayer.Character:FindFirstChild("Head")
- local velocity = humanoidRootPart.Velocity
- local adjustedVelocity = Vector3.new(
- math.clamp(velocity.X, -50, 50),
- math.clamp(velocity.Y, -50, 50),
- math.clamp(velocity.Z, -50, 50)
- )
- local predictedPosition = humanoidRootPart.Position + adjustedVelocity * verticalPrediction
- predictedPosition = Vector3.new(
- predictedPosition.X + xOffset,
- predictedPosition.Y + yOffset,
- predictedPosition.Z + zOffset
- )
- if adjustedVelocity.Y > 2 then
- if head then
- predictedPosition = head.Position + Vector3.new(0, 0.5, 0)
- end
- elseif adjustedVelocity.Y < -2 then
- predictedPosition = humanoidRootPart.Position + Vector3.new(0, -0.5, 0)
- end
- return predictedPosition
- end
- return nil
- end
- local function lockOn()
- local closestPlayer = nil
- local shortestDistance = math.huge
- local screenCenter = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2)
- for _, p in pairs(game.Players:GetPlayers()) do
- if p ~= player then
- local character = p.Character
- if character and character:FindFirstChild("HumanoidRootPart") then
- local head = character.HumanoidRootPart
- local headPos = camera:WorldToScreenPoint(head.Position)
- local distance = (screenCenter - Vector2.new(headPos.X, headPos.Y)).Magnitude
- if distance < shortestDistance then
- shortestDistance = distance
- closestPlayer = p
- end
- end
- end
- end
- if closestPlayer then
- lockedPlayer = closestPlayer
- isLockedOn = true
- else
- print("No player found to lock onto.")
- end
- end
- local function smoothlyDragToPlayer(targetPlayer)
- if targetPlayer then
- local predictedPosition = enhancedPrediction(targetPlayer)
- if predictedPosition then
- local currentPosition = camera.CFrame.Position
- camera.CFrame = CFrame.new(currentPosition:Lerp(predictedPosition, smoothSpeed), predictedPosition)
- end
- end
- end
- local function createLockButtonGUI()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = playerGui
- local lockButton = Instance.new("TextButton")
- lockButton.Size = UDim2.new(0, 100, 0, 50)
- lockButton.Position = UDim2.new(1, -110, 0, 10)
- lockButton.Text = "Lock On"
- lockButton.Font = Enum.Font.GothamBold
- lockButton.TextColor3 = Color3.new(1, 1, 1)
- lockButton.BackgroundColor3 = Color3.fromRGB(50, 50, 200)
- lockButton.Parent = screenGui
- local function makeRainbow(button)
- local colorIndex = 0
- task.spawn(function()
- while true do
- colorIndex = (colorIndex + 1) % 360
- button.BackgroundColor3 = Color3.fromHSV(colorIndex / 360, 1, 1)
- button.BorderSizePixel = 2
- button.BorderColor3 = Color3.new(1, 1, 1)
- task.wait(0.05)
- end
- end)
- end
- makeRainbow(lockButton)
- lockButton.MouseButton1Click:Connect(function()
- if isLockedOn then
- lockedPlayer = nil
- isLockedOn = false
- lockButton.Text = "Lock On"
- else
- lockOn()
- lockButton.Text = "Locked"
- end
- end)
- end
- createLockButtonGUI()
- game:GetService("RunService").Heartbeat:Connect(function()
- if isLockedOn and lockedPlayer then
- smoothlyDragToPlayer(lockedPlayer)
- end
- end)
- local player = game.Players.LocalPlayer
- local screenGui = Instance.new("ScreenGui")
- local textLabel = Instance.new("TextLabel")
- local copiedTextLabel = Instance.new("TextLabel")
- screenGui.Parent = player:WaitForChild("PlayerGui")
- screenGui.ResetOnSpawn = false
- local function playAudio()
- local sound = Instance.new("Sound")
- sound.SoundId = "rbxassetid://158012252"
- sound.Parent = game.Workspace
- sound:Play()
- end
- local function displayTextAtTop()
- textLabel.Text = "Cware"
- textLabel.Position = UDim2.new(0.5, -75, 0, 10)
- textLabel.Size = UDim2.new(0, 150, 0, 50)
- textLabel.TextSize = 30
- textLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
- textLabel.BackgroundTransparency = 1
- textLabel.TextTransparency = 0
- textLabel.TextStrokeTransparency = 0.8
- textLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
- textLabel.Font = Enum.Font.GothamBold
- textLabel.Parent = screenGui
- local function makeRainbowText()
- local colors = {Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 165, 0), Color3.fromRGB(255, 255, 0), Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 0, 255), Color3.fromRGB(75, 0, 130), Color3.fromRGB(238, 130, 238)}
- local index = 1
- while true do
- textLabel.TextColor3 = colors[index]
- index = index + 1
- if index > #colors then
- index = 1
- end
- wait(0.1)
- end
- end
- coroutine.wrap(makeRainbowText)()
- end
- local function displayCopiedText()
- copiedTextLabel.Text = "COPIED DISCORD LINK JOIN FOR UPDATES!"
- copiedTextLabel.Position = UDim2.new(0.5, -150, 0, -40)
- copiedTextLabel.Size = UDim2.new(0, 300, 0, 30)
- copiedTextLabel.TextSize = 14
- copiedTextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- copiedTextLabel.BackgroundTransparency = 1
- copiedTextLabel.TextTransparency = 0
- copiedTextLabel.TextStrokeTransparency = 0.8
- copiedTextLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
- copiedTextLabel.Font = Enum.Font.GothamBold
- copiedTextLabel.Parent = screenGui
- wait(4)
- copiedTextLabel:TweenTransparency(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 1, true)
- end
- local function copyDiscordLink()
- setclipboard("https://discord.gg/HwTmqpfwft")
- end
- playAudio()
- copyDiscordLink()
- displayTextAtTop()
- displayCopiedText()
- player.CharacterAdded:Connect(function()
- createLockButtonGUI()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement