Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Services
- local Players = game:GetService("Players")
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- local Lighting = game:GetService("Lighting")
- local player = Players.LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- -- Create ScreenGui
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "AimlockMenuGui"
- screenGui.Parent = playerGui
- screenGui.ResetOnSpawn = false
- -- Menu Frame
- local menuFrame = Instance.new("Frame")
- menuFrame.Size = UDim2.new(0, 500, 0, 400)
- menuFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- menuFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
- menuFrame.BackgroundColor3 = Color3.fromRGB(245, 245, 245)
- menuFrame.BackgroundTransparency = 1
- menuFrame.BorderSizePixel = 0
- menuFrame.Visible = false
- menuFrame.ZIndex = 1
- menuFrame.Parent = screenGui
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 16)
- corner.Parent = menuFrame
- local gradient = Instance.new("UIGradient")
- gradient.Color = ColorSequence.new{
- ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 220)),
- ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 230, 150))
- }
- gradient.Rotation = 45
- gradient.Parent = menuFrame
- local pulseStroke = Instance.new("UIStroke")
- pulseStroke.Parent = menuFrame
- pulseStroke.Thickness = 3
- pulseStroke.Color = Color3.fromRGB(255, 204, 0)
- pulseStroke.Transparency = 1
- pulseStroke.Enabled = false
- -- Icon Setup
- local iconSize = UDim2.new(0, 50, 0, 50)
- local iconStartPos = UDim2.new(0.05, 0, 0.05, 0)
- local iconAboveMenuPos = UDim2.new(0.5, 0, 0.5, -menuFrame.Size.Y.Offset/2 - 60)
- local iconButton = Instance.new("ImageButton")
- iconButton.Size = iconSize
- iconButton.AnchorPoint = Vector2.new(0.5, 0.5)
- iconButton.Position = iconStartPos
- iconButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- iconButton.ImageTransparency = 0
- iconButton.BackgroundTransparency = 0
- iconButton.ZIndex = 2
- iconButton.Parent = screenGui
- local iconCorner = Instance.new("UICorner")
- iconCorner.CornerRadius = UDim.new(1, 0)
- iconCorner.Parent = iconButton
- local iconOutline = Instance.new("UIStroke")
- iconOutline.Parent = iconButton
- iconOutline.Color = Color3.fromRGB(255, 204, 0)
- iconOutline.Thickness = 2
- iconOutline.Transparency = 0
- -- Set avatar image
- local userId = player.UserId
- local thumb, _ = Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
- iconButton.Image = thumb
- -- Blur effect
- local blur = Lighting:FindFirstChild("AimlockMenuBlur") or Instance.new("BlurEffect", Lighting)
- blur.Name = "AimlockMenuBlur"
- blur.Size = 0
- -- Toggle logic
- local menuOpen = false
- local canToggle = true
- local function tweenAndWait(instance, tweenInfo, properties)
- local tween = TweenService:Create(instance, tweenInfo, properties)
- tween:Play()
- local finished = Instance.new("BindableEvent")
- tween.Completed:Connect(function()
- finished:Fire()
- finished:Destroy()
- end)
- finished.Event:Wait()
- end
- local function fade(instance, props, duration)
- return TweenService:Create(instance, TweenInfo.new(duration), props)
- end
- local function openMenu()
- menuFrame.Visible = true
- pulseStroke.Enabled = true
- -- Blur in
- tweenAndWait(blur, TweenInfo.new(0.5), {Size = 24})
- -- Fade out icon fully
- tweenAndWait(iconButton, TweenInfo.new(0.2), {ImageTransparency = 1, BackgroundTransparency = 1})
- tweenAndWait(iconOutline, TweenInfo.new(0.2), {Transparency = 1})
- -- Move icon above menu
- tweenAndWait(iconButton, TweenInfo.new(0.4), {Position = iconAboveMenuPos})
- -- Fade icon back in
- tweenAndWait(iconButton, TweenInfo.new(0.3), {ImageTransparency = 0, BackgroundTransparency = 0})
- tweenAndWait(iconOutline, TweenInfo.new(0.3), {Transparency = 0})
- -- Fade in menu and stroke
- tweenAndWait(menuFrame, TweenInfo.new(0.4), {BackgroundTransparency = 0})
- tweenAndWait(pulseStroke, TweenInfo.new(0.4), {Transparency = 0.2})
- end
- local function closeMenu()
- -- Fade out menu and stroke
- tweenAndWait(menuFrame, TweenInfo.new(0.4), {BackgroundTransparency = 1})
- tweenAndWait(pulseStroke, TweenInfo.new(0.4), {Transparency = 1})
- pulseStroke.Enabled = false
- -- Blur out
- tweenAndWait(blur, TweenInfo.new(0.5), {Size = 0})
- -- Fade out icon fully
- tweenAndWait(iconButton, TweenInfo.new(0.2), {ImageTransparency = 1, BackgroundTransparency = 1})
- tweenAndWait(iconOutline, TweenInfo.new(0.2), {Transparency = 1})
- -- Move icon back
- tweenAndWait(iconButton, TweenInfo.new(0.4), {Position = iconStartPos})
- -- Fade icon back in
- tweenAndWait(iconButton, TweenInfo.new(0.3), {ImageTransparency = 0, BackgroundTransparency = 0})
- tweenAndWait(iconOutline, TweenInfo.new(0.3), {Transparency = 0})
- menuFrame.Visible = false
- end
- local function toggleMenu()
- if not canToggle then return end
- canToggle = false
- if menuOpen then
- closeMenu()
- else
- openMenu()
- end
- menuOpen = not menuOpen
- task.delay(1, function()
- canToggle = true
- end)
- end
- -- Inputs
- UserInputService.InputBegan:Connect(function(input, gp)
- if gp then return end
- if input.KeyCode == Enum.KeyCode.Y then
- toggleMenu()
- end
- end)
- iconButton.MouseButton1Click:Connect(function()
- toggleMenu()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement