-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAAZsa.lua
More file actions
49 lines (41 loc) · 1.39 KB
/
AAZsa.lua
File metadata and controls
49 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--// Head Lock Button Script (Safe for your own game)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
-- CONFIG
local targetName = "Dummy" -- Change to the name of NPC you want to lock onto
local headLockEnabled = false
-- Create Button UI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = player:WaitForChild("PlayerGui")
local Button = Instance.new("TextButton")
Button.Size = UDim2.new(0, 150, 0, 50)
Button.Position = UDim2.new(0.05, 0, 0.8, 0)
Button.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
Button.TextColor3 = Color3.new(1, 1, 1)
Button.TextScaled = true
Button.Text = "Head Lock OFF"
Button.Parent = ScreenGui
-- Function to find head of target
local function getTargetHead()
local target = workspace:FindFirstChild(targetName)
if target and target:FindFirstChild("Head") then
return target.Head
end
return nil
end
-- Toggle button
Button.MouseButton1Click:Connect(function()
headLockEnabled = not headLockEnabled
Button.Text = headLockEnabled and "Head Lock ON" or "Head Lock OFF"
end)
-- Update camera
RunService.RenderStepped:Connect(function()
if headLockEnabled then
local head = getTargetHead()
if head then
camera.CFrame = CFrame.new(camera.CFrame.Position, head.Position)
end
end
end)