ADVERTISEMENTREMOVE ADS
FOV - ANY MODE
47,396 views
Universal script•
4 months ago

Script Preview
Description
you can make different viewing angles with this script, I don't know if it works on the phone
ADVERTISEMENTREMOVE ADS
114 Lines • 3.43 KiB
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local playerGui = player:WaitForChild("PlayerGui")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local minFOV, maxFOV = 40, 120
-- GUI
local gui = Instance.new("ScreenGui", playerGui)
gui.Name = "FOV_UI"
gui.ResetOnSpawn = false
-- Перемещаемая рамка
local container = Instance.new("Frame", gui)
container.Size = UDim2.new(0, 320, 0, 90)
container.Position = UDim2.new(0.5, -160, 0.88, 0)
container.BackgroundTransparency = 1
-- Ползунок фон
local bg = Instance.new("Frame", container)
bg.Size = UDim2.new(1, 0, 0, 40)
bg.Position = UDim2.new(0, 0, 0, 0)
bg.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
bg.BorderSizePixel = 0
Instance.new("UICorner", bg)
-- Бегунок
local slider = Instance.new("TextButton", bg)
slider.Size = UDim2.new(0, 20, 1, 0)
slider.Position = UDim2.new(0.5, -10, 0, 0)
slider.BackgroundColor3 = Color3.fromRGB(255, 160, 80)
slider.Text = ""
slider.AutoButtonColor = false
Instance.new("UICorner", slider)
-- Метка FOV
local label = Instance.new("TextLabel", bg)
label.Size = UDim2.new(1, 0, 0, 24)
label.Position = UDim2.new(0, 0, -1, -5)
label.BackgroundTransparency = 1
label.TextColor3 = Color3.new(1, 1, 1)
label.Font = Enum.Font.GothamBold
label.TextSize = 18
label.Text = "Поле зрения: 90°"
-- Кнопка скрытия
local toggle = Instance.new("TextButton", container)
toggle.Size = UDim2.new(0, 130, 0, 26)
toggle.Position = UDim2.new(0.5, -65, 1, 4)
toggle.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
toggle.TextColor3 = Color3.fromRGB(255, 255, 255)
toggle.Font = Enum.Font.GothamSemibold
toggle.TextSize = 15
toggle.Text = "Скрыть"
Instance.new("UICorner", toggle)
-- Скрытие и показ
local hidden = false
toggle.MouseButton1Click:Connect(function()
hidden = not hidden
bg.Visible = not hidden
label.Visible = not hidden
slider.Visible = not hidden
toggle.Text = hidden and "Показать" or "Скрыть"
end)
-- Перетаскивание
local dragging = false
local offset
bg.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
offset = UIS:GetMouseLocation() - container.AbsolutePosition
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = false
end
end)
RunService.RenderStepped:Connect(function()
if dragging and offset then
local pos = UIS:GetMouseLocation() - offset
container.Position = UDim2.new(0, pos.X, 0, pos.Y)
end
end)
-- Работа ползунка
local sliding = false
slider.MouseButton1Down:Connect(function()
sliding = true
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
sliding = false
end
end)
RunService.RenderStepped:Connect(function()
if sliding then
local mouseX = UIS:GetMouseLocation().X
local frameX = bg.AbsolutePosition.X
local width = bg.AbsoluteSize.X
local relX = math.clamp(mouseX - frameX, 0, width)
local percent = relX / width
slider.Position = UDim2.new(0, relX - slider.AbsoluteSize.X/2, 0, 0)
local fov = math.floor(minFOV + (maxFOV - minFOV) * percent)
camera.FieldOfView = fov
label.Text = "Поле зрения: " .. fov .. "°"
end
end)
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS







Comments