Good
Key RequiredUniversal

Good

Universal ScriptvobBoxvobBox 1.6K views 18 executesUpdated May 2, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•141 lines (3841 chars)
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Camera = workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer

local fovList = {100, 80, 70, 90}
local fovIndex = 1

-- بيانات الاهتزاز
local isShaking = false
local shakeDuration = 0.25
local shakeMagnitude = 0.25
local shakeStartTime = 0.25
local originalCFrame = nil

-- فحص المنظور
local function isFirstPerson()
	return (Camera.CFrame.Position - Camera.Focus.Position).Magnitude < 1
end

-- تحريك الكاميرا تدريجياً
local function transitionToThirdPerson()
	if not LocalPlayer.Character then return end
	local hrp = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
	if not hrp then return end

	local targetPos = hrp.Position - hrp.CFrame.LookVector * 4 + Vector3.new(0, 2, 0)
	local newCFrame = CFrame.new(targetPos, hrp.Position)

	local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
	local goal = {CFrame = newCFrame}
	local tween = TweenService:Create(Camera, tweenInfo, goal)
	tween:Play()
end

-- الاهتزاز في المنظور الثالث فقط
local function startShake()
	if isFirstPerson() then return end

	if isShaking then
		isShaking = false
		wait()
	end

	isShaking = true
	shakeStartTime = tick()
	originalCFrame = Camera.CFrame
end

local function applyShake()
	if isShaking and not isFirstPerson() then
		local elapsed = tick() - shakeStartTime
		if elapsed < shakeDuration then
			local offset = Vector3.new(
				(math.random() - 0.5) * shakeMagnitude,
				(math.random() - 0.5) * shakeMagnitude,
				(math.random() - 0.5) * shakeMagnitude
			)
			Camera.CFrame = originalCFrame * CFrame.new(offset)
		else
			isShaking = false
			Camera.CFrame = originalCFrame
			originalCFrame = nil
		end
	end
end

-- التعامل مع الضغط على R
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.R then
		fovIndex += 1
		if fovIndex > #fovList then fovIndex = 1 end

		local wasFirstPerson = isFirstPerson()

		Camera.FieldOfView = fovList[fovIndex]

		if wasFirstPerson and not isFirstPerson() then
			transitionToThirdPerson()
		end

		startShake()
	end
end)

-- الشفافية ومنع الرأس والإكسسوارات فقط في المنظور الأول
local function setupCharacter(character)
	local humanoid = character:WaitForChild("Humanoid")

	RunService.RenderStepped:Connect(function()
		local inFirstPerson = isFirstPerson()
		local head = character:FindFirstChild("Head")

		-- الرأس
		if head then
			head.LocalTransparencyModifier = inFirstPerson and 1 or 0
		end

		-- الإكسسوارات
		for _, accessory in ipairs(character:GetChildren()) do
			if accessory:IsA("Accessory") then
				local handle = accessory:FindFirstChild("Handle")
				if handle then
					handle.LocalTransparencyModifier = inFirstPerson and 1 or 0
				end
			end
		end

		-- باقي أجزاء الجسم تبقى ظاهرة
		for _, partName in ipairs({
			"RightUpperArm", "RightLowerArm", "RightHand",
			"LeftUpperArm", "LeftLowerArm", "LeftHand",
			"RightUpperLeg", "RightLowerLeg", "RightFoot",
			"LeftUpperLeg", "LeftLowerLeg", "LeftFoot",
			"UpperTorso", "LowerTorso"
		}) do
			local part = character:FindFirstChild(partName)
			if part then
				part.LocalTransparencyModifier = 0
			end
		end

		-- تعويض الكاميرا أثناء الحركة
		local root = character:FindFirstChild("HumanoidRootPart")
		if root then
			local isMoving = root:FindFirstChild("Running") and root.Running.IsPlaying
			humanoid.CameraOffset = isMoving and Vector3.new(0, 0, -1.75) or Vector3.new(0, -0.1, -1.75)
		end

		applyShake()
	end)
end

-- تشغيل السكربت عند جاهزية الشخصية
if LocalPlayer.Character then
	setupCharacter(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:Connect(setupCharacter)

Features & Information

Uuy

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts