the thing is, I write code, how I write it...I've received this error: Frame is not a valid member of Frame. What am I to do? I'm still new to coding, and I'm not sure what the mistake is.here is the script:
local frame = script.Parent.Parent.Frame local open = script.Parent.Parent.Open local blur = Instance.new("BlurEffect",game.Workspace.CurrentCamera) blur.Size = 0 script.Parent.MouseButton1Click:connect(function() if open.Value == false then frame:TweenPosition(UDim2.new(0.5,-250,0.5,-175),"Out","Quint",1,true) for i = 0,10,1 do wait() blur.Size = i end open.Value = true elseif open.Value == true then frame:TweenPosition(UDim2.new(0.5,-250,-0.5,-175),"Out","Quint",1,true) for i = 10,0,-1 do wait() blur.Size = i end open.Value = false end end)
I need the button to close the store menu, but that doesn't happen. but when I press the "open shop" button, then everything perfectly opens and closes, and there is the same script, and everything is normal, what is wrong here?I wrote that the error in 1 line, but no matter what I tried, nothing worked
Taking a stab in the dark since I don't exactly know the hierarchy for your GUI, but try adding a WaitForChild() to ensure that "frame" is added. I've made a function for tweening to save some readability.
local frame = script.Parent.Parent.Frame local open = script.Parent.Parent.Open local blur = Instance.new("BlurEffect", game.Workspace.CurrentCamera) blur.Size = 0 local function tweenFrame(tweenIncrement, blurIncrement) frame:TweenPosition(UDim2.new(0.5, -250, tweenIncrement, -175), "Out", "Quint", 1, true) for i = 0, 10, blurIncrement do wait() blur.Size = i end open.Value = not open.Value end script.Parent.MouseButton1Click:Connect(function() if not open.Value then tweenFrame(0.5, 1) elseif open.Value then tweenFrame(-0.5, -1) end end)