#Anyone know why my shop gui script to open and close the gui wont work?

1 messages · Page 1 of 1 (latest)

waxen fern
#

-- Services
local TweenService = game:GetService("TweenService")

local Camera = workspace.CurrentCamera
local Blur = Instance.new("BlurEffect", Camera)
Blur.Size = 12
Blur.Enabled = false

local GUI = script.Parent
local ShopWindow = GUI.Shop
ShopWindow.Visible = false

local openShop = GUI.OpenShop

local function OpenWindow()
ShopWindow.Visible = true
ShopWindow.Position = UDim2.new(0.5, 0, 0.55, 0)
TweenService:Create(ShopWindow, TweenInfo.new(0.1), {Position = UDim2.new(0.5, 0, 0.5, 0)}):Play()
TweenService:Create(Camera, TweenInfo.new(0.1), {FieldOfView = 75}):Play()
Blur.Enabled = true
end

local function CloseWindow()
TweenService:Create(ShopWindow, TweenInfo.new(0.05), {Position = UDim2.new(0.5, 0, 0.55, 0)}):Play()
TweenService:Create(Camera, TweenInfo.new(0.05), {FieldOfView = 70}):Play()
Blur.Enabled = false
task.wait(0.05)
ShopWindow.Visible = false
end

openShop.MouseButton1Click:Connect(function()
if ShopWindow.Visible == true then
CloseWindow()
else
OpenWindow()
end
end)

ShopWindow.Exit.MouseButton1Click:Connect(CloseWindow)

serene bone
#

Copy and pasted it into a gui I quickly made, and it worked fine.

#

If you got this from a video/ai or something and didn't make it yourself, it could be that you need to be using a local script or put the script in the wrong place

waxen fern
#

I made it myself but put it into the shop button to open the shop and it didn't work but I got it to work now

devout jasper