Hello ![]()
I need help with a script that i Technicly made
I have made the script so that uhh, well it kind of is explanatory by the script itself but im gonna explain it anyway:
1. I made it for animating the frame, but the MouseButton1Click part doesnt work!
2. I ran it a couple of times through chat gpt and it didint help with anything, i spent half day to make this script and like a hour with chat gpt but i dont think i will find the answer there so i went on the devforum, its a bit more organised i guess
Heres the script
-- Import the TweenService
local TweenService = game:GetService("TweenService")
-- Ensure script.Parent.Parent is PlayerGui
local parent = script.Parent.Parent
while not parent:IsA("PlayerGui") do
parent = parent.Parent
end
-- Reference to the MainWarningFrame
local frame = script.Parent:WaitForChild("MainWarningFrame")
local blurInstance = Instance.new("BlurEffect")
blurInstance.Parent = game.Lighting
blurInstance.Enabled = false
blurInstance.Size = 0
-- Set AnchorPoint to the center
frame.AnchorPoint = Vector2.new(0.5, 0.5)
-- Store the original position and size of the frame
local originalPosition = frame.Position
local originalSize = frame.Size
-- Move the frame below the screen initially
frame.Position = UDim2.new(0.5, originalPosition.X.Offset, 1.5, originalPosition.Y.Offset)
-- Tween configurations
local hoverTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
local shrinkTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quart, Enum.EasingDirection.In)
local blurTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
local moveBelowTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.In)
-- Hover effects
local hoverSize = UDim2.new(originalSize.X.Scale * 1.1, originalSize.X.Offset * 1.1, originalSize.Y.Scale * 1.1, originalSize.Y.Offset * 1.1)
local hoverTween = TweenService:Create(frame, hoverTweenInfo, {Size = hoverSize})
local shrinkTween = TweenService:Create(frame, shrinkTweenInfo, {Size = originalSize})
local function onHoverEnter()
hoverTween:Play()
end
local function onHoverLeave()
shrinkTween:Play()
end
-- Button click handler
local function onStayClick()
-- Tween blur back to normal and move frame below screen
local shrinkBlurTween = TweenService:Create(blurInstance, blurTweenInfo, {Size = 0})
local moveBelowTween = TweenService:Create(frame, moveBelowTweenInfo, {Position = UDim2.new(0.5, originalPosition.X.Offset, 1.5, originalPosition.Y.Offset)})
shrinkBlurTween:Play()
moveBelowTween:Play()
-- Wait until animations finish, then clean up
wait(moveBelowTweenInfo.Time)
script.Parent.Parent:Destroy()
end
-- Set up the initial view
local function initialSetup()
-- Apply blur after 3 seconds
wait(3)
blurInstance.Enabled = true
local applyBlurTween = TweenService:Create(blurInstance, blurTweenInfo, {Size = 20})
applyBlurTween:Play()
-- Move frame to its position after 2 more seconds
wait(2)
local moveTween = TweenService:Create(frame, blurTweenInfo, {Position = UDim2.new(0.5, originalPosition.X.Offset, 0.5, originalPosition.Y.Offset)})
moveTween:Play()
end
-- Connect events
frame.MouseEnter:Connect(onHoverEnter)
frame.MouseLeave:Connect(onHoverLeave)
local stayButton = frame:WaitForChild("Stay")
stayButton.MouseButton1Click:Connect(onStayClick)
-- Start setup
initialSetup()

