Pastefi mark
scrip shift lock
/fad03bb2
Paste view
PYTHON PUBLIC 36 views
fad03bb2
2026-01-08 13:43:02
loading -- Shift Lock Script
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local enabled = false

local function toggleShiftLock()
	enabled = not enabled
	
	if enabled then
		player.CameraMode = Enum.CameraMode.LockFirstPerson
		player.CameraMaxZoomDistance = 10
	else
		player.CameraMode = Enum.CameraMode.Classic
	end
end

-- PC: nhấn Shift
UIS.InputBegan:Connect(function(input, gp)
	if gp then return end
	if input.KeyCode == Enum.KeyCode.LeftShift then
		toggleShiftLock()
	end
end)

-- Mobile: chạm 2 ngón
UIS.TouchTap:Connect(function(touches, gp)
	if #touches == 2 then
		toggleShiftLock()
	end
end)

-- Xoay nhân vật theo camera
RunService.RenderStepped:Connect(function()
	if enabled and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
		local hrp = player.Character.HumanoidRootPart
		local camLook = camera.CFrame.LookVector
		hrp.CFrame = CFrame.new(hrp.Position, hrp.Position + Vector3.new(camLook.X, 0, camLook.Z))
	end
end)

Comments (0)

Log in to leave a comment.

No comments yet.