Open frame function not work

`local function OpenFrame()
for _, frame in ipairs(FramesFolder:GetChildren()) do
if not frame.Visible then
CloseAllFrame()
CloseAll()
Services.TweenService:Create(Camera, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {FieldOfView = 80}):Play()
Blur.Visible = true
frame.Visible = true
frame.Position = UDim2.fromScale(0.5,0.525)
Services.TweenService:Create(frame, TweenInfo.new(0.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Position = UDim2.fromScale(0.5,0.5)}):Play()
else
CloseAllFrame()
OpenAll()
end
end
end

OpenFrame(UpgradesFrame)`

In the future, I recommend using the Preformatted Text button for scripts
image

Regarding the script: You send any variable to the function:

But do not use it in the function itself:

1 Like

I fixed it and it worked, thanks

local function OpenFrame(frame: Frame)
		if not frame.Visible then
			CloseAllFrame()
			CloseAll()
			Services.TweenService:Create(Camera, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {FieldOfView = 80}):Play()
			Blur.Visible = true
			frame.Visible = true
			frame.Position = UDim2.fromScale(0.5,0.525)
			Services.TweenService:Create(frame, TweenInfo.new(0.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Position = UDim2.fromScale(0.5,0.5)}):Play()
		else
			CloseAllFrame()
			OpenAll()
	end
end

Left.Upgrade.Button.MouseButton1Click:Connect(OpenFrame(UpgradesFrame))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.