1 | local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/bloodball/-back-ups-for-libs/main/wizard"))() |
2 | |
3 | local detectionRadius = 0 |
4 | local rotationAngle = math.rad(0) |
5 | local player = game.Players.LocalPlayer |
6 | local scriptEnabled = false |
7 | |
8 | local Window = Library:NewWindow("Window") |
9 | local Section = Window:NewSection("Settings") |
10 | |
11 | Section:CreateTextbox("Detection Radius", function(text) |
12 | local radius = tonumber(text) |
13 | if radius then |
14 | detectionRadius = radius |
15 | end |
16 | end) |
17 | |
18 | Section:CreateTextbox("Rotation Angle (degrees)", function(text) |
19 | local angle = tonumber(text) |
20 | if angle then |
21 | rotationAngle = math.rad(angle) |
22 | end |
23 | end) |
24 | |
25 | Section:CreateToggle("Enable Script", function(value) |
26 | scriptEnabled = value |
27 | end) |
28 | |
29 | local function findClosestPlayer() |
30 | local closestPlayer = nil |
31 | local closestDistance = math.huge |
32 | local character = player.Character |
33 | |
34 | if character and character:FindFirstChild("HumanoidRootPart") then |
35 | local playerPosition = character.HumanoidRootPart.Position |
36 | |
37 | for _, otherPlayer in pairs(game.Players:GetPlayers()) do |
38 | if otherPlayer ~= player and otherPlayer.Character and otherPlayer.Character:FindFirstChild("Humanoid") then |
39 | local humanoid = otherPlayer.Character.Humanoid |
40 | if humanoid.Health > 0 and otherPlayer.Character:FindFirstChild("HumanoidRootPart") then |
41 | local distance = (otherPlayer.Character.HumanoidRootPart.Position - playerPosition).Magnitude |
42 | if distance < detectionRadius and distance < closestDistance then |
43 | closestPlayer = otherPlayer |
44 | closestDistance = distance |
45 | end |
46 | end |
47 | end |
48 | end |
49 | end |
50 | |
51 | return closestPlayer |
52 | end |
53 | |
54 | local function lookAtClosestPlayer() |
55 | if not scriptEnabled then return end |
56 | |
57 | local closestPlayer = findClosestPlayer() |
58 | local character = player.Character |
59 | |
60 | if closestPlayer and character and character:FindFirstChild("HumanoidRootPart") then |
61 | local direction = (closestPlayer.Character.HumanoidRootPart.Position - character.HumanoidRootPart.Position).unit |
62 | local rotatedDirection = CFrame.Angles(0, rotationAngle, 0) * direction |
63 | local lookVector = Vector3.new(rotatedDirection.X, 0, rotatedDirection.Z) |
64 | character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position + lookVector) |
65 | end |
66 | end |
67 | |
68 | local function onCharacterAdded(newCharacter) |
69 | newCharacter:WaitForChild("HumanoidRootPart") |
70 | end |
71 | |
72 | game:GetService("RunService").RenderStepped:Connect(function() |
73 | lookAtClosestPlayer() |
74 | end) |
75 | |
76 | player.CharacterAdded:Connect(onCharacterAdded) |
77 | |
78 | if player.Character then |
79 | onCharacterAdded(player.Character) |
80 | end |
81 | |
82 | game.StarterGui:SetCore("SendNotification", { |
83 | Title = "Credits: Vxpreen"; |
84 | Text = "soulreavers._13 on discord"; |
85 | Duration = 8 |
86 | }) |