ADVERTISEMENTREMOVE ADS
Gui zoom v1
45,953 views
Universal script•
2 months ago

Script Preview
Description
🇷🇺 1 Зум приближает 2 отдаляет
🇺🇲 1 Zoom zooms in 2 zooms out
ADVERTISEMENTREMOVE ADS
86 Lines • 2.77 KiB
local player = game:GetService("Players").LocalPlayer
local us = game:GetService("UserInputService")
local screenGui = Instance.new("ScreenGui")
local frame = Instance.new("Frame")
local zoomInButton = Instance.new("TextButton")
local zoomOutButton = Instance.new("TextButton")
local closeButton = Instance.new("TextButton")
local camera = workspace.CurrentCamera
local isDragging = false
local offset = nil
local isOpen = true
screenGui.Name = "ZoomMenu"
screenGui.Parent = player.PlayerGui
screenGui.ResetOnSpawn = false
frame.Parent = screenGui
frame.Size = UDim2.new(0, 200, 0, 150)
frame.Position = UDim2.new(0.5, -100, 0.5, -75)
frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
frame.BorderSizePixel = 2
frame.Draggable = true
zoomInButton.Parent = frame
zoomInButton.Size = UDim2.new(1, 0, 0.3, 0)
zoomInButton.Text = "Zoom In"
zoomInButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
zoomInButton.MouseButton1Click:Connect(function()
camera.FieldOfView = camera.FieldOfView - 5
end)
zoomOutButton.Parent = frame
zoomOutButton.Size = UDim2.new(1, 0, 0.3, 0)
zoomOutButton.Position = UDim2.new(0, 0, 0.33, 0)
zoomOutButton.Text = "Zoom Out"
zoomOutButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
zoomOutButton.MouseButton1Click:Connect(function()
camera.FieldOfView = camera.FieldOfView + 5
end)
closeButton.Parent = frame
closeButton.Size = UDim2.new(1, 0, 0.3, 0)
closeButton.Position = UDim2.new(0, 0, 0.66, 0)
closeButton.Text = "X"
closeButton.BackgroundColor3 = Color3.fromRGB(255, 255, 0)
closeButton.MouseButton1Click:Connect(function()
isOpen = not isOpen
frame.Visible = isOpen
end)
us.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local hit = us:GetTarget()
if hit and hit:IsA("GuiObject") and hit.Parent == frame then
isDragging = true
offset = (us:GetMouseLocation() - frame.AbsolutePosition)
end
end
end)
us.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isDragging = false
end
end)
us.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and isDragging then
local newPos = us:GetMouseLocation() - offset
frame.Position = UDim2.new(0, newPos.X, 0, newPos.Y)
end
end)
player.CharacterAdded:Connect(function()
if screenGui:FindFirstChild("ZoomMenu") then
frame.Visible = isOpen
end
end)
us.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
camera.FieldOfView = camera.FieldOfView - 0.5
elseif input.KeyCode == Enum.KeyCode.Q then
camera.FieldOfView = camera.FieldOfView + 0.5
end
end)
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS







Comments