#HElp me with Quest system fix
1 messages · Page 1 of 1 (latest)
local gui = script.Parent
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local questFrame = gui:WaitForChild("QuestFrame")
local exitButton = questFrame:WaitForChild("ExitButton")
local openQuestEvent = ReplicatedStorage:WaitForChild("OpenQuestEvent")
local blur
local function openGui()
if blur and blur.Parent then
blur:Destroy()
end
blur = Instance.new("Frame")
blur.Name = "BlurOverlay"
blur.Size = UDim2.new(1, 0, 1, 0)
blur.Position = UDim2.new(0, 0, 0, 0)
blur.BackgroundColor3 = Color3.new(0, 0, 0)
blur.BackgroundTransparency = 1
blur.ZIndex = 0
blur.Parent = gui
questFrame.ZIndex = 2
questFrame.Visible = true
questFrame.Size = UDim2.new(0.1, 0, 0.1, 0)
local blurTween = TweenService:Create(blur, TweenInfo.new(0.3), {
BackgroundTransparency = 0.5
})
local scaleInTween = TweenService:Create(questFrame, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
Size = UDim2.new(0.75, 0, 0.75, 0)
})
blurTween:Play()
scaleInTween:Play()
gui.Enabled = true
end
local function closeGui()
if not blur then return end
local blurOutTween = TweenService:Create(blur, TweenInfo.new(0.3), {
BackgroundTransparency = 1
})
local scaleOutTween = TweenService:Create(questFrame, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {
Size = UDim2.new(0.1, 0, 0.1, 0)
})
blurOutTween:Play()
scaleOutTween:Play()
scaleOutTween.Completed:Connect(function()
gui.Enabled = false
questFrame.Visible = false
if blur and blur.Parent then
blur:Destroy()
end
blur = nil
end)
end
exitButton.MouseButton1Click:Connect(function()
closeGui()
end)
openQuestEvent.OnClientEvent:Connect(function()
openGui()
end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local closeQuestEvent = ReplicatedStorage:WaitForChild("CloseQuestEvent")
local function closeGui()
closeQuestEvent:FireServer()
end
exitButton.MouseButton1Click:Connect(function()
closeGui()
end)