Frame doesn't appear after click?

I’m currently making an admin panel and I’m in the process of finishing tweening, but the only issue is that everything works but the frame won’t appear even though no error appears in the output.

local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
local replicatedStorage = game:GetService("ReplicatedStorage")
local iconModule = replicatedStorage.Icon
local Icon = require(iconModule)
local IconController = require(iconModule.IconController)
local Themes = require(iconModule.Themes)
local adminMenu = game.StarterGui.AdminGui
local adminFrame = game.StarterGui.AdminGui.Frame
local playerUI = player:FindFirstChild("PlayerGui")
local canViewIcon = false
if player:GetRankInGroup(10565031) > 6 then
	canViewIcon = true
end


Icon.new()
:setEnabled(canViewIcon)
:setName("AdminPanel")
:setImage(7072721855)
:setLabel("Admin Panel")
:bindEvent("selected", function()
	playerUI.AdminGui.Frame.Visible = true
	adminFrame.AnchorPoint = Vector2.new(0, 0)
	adminFrame.Position = UDim2.new(1.1, 0, 0.178, 0)
	wait(0.5)
	adminFrame:TweenPosition(UDim2.new(0.83, 0, 0.178, 0))
end)
:bindEvent("deselected", function()
	adminFrame.AnchorPoint = Vector2.new(0, 0)
	adminFrame.Position = UDim2.new(0.83, 0, 0.178, 0)
	wait(0.5)
	adminFrame:TweenPosition(UDim2.new(1.1, 0, 0.178, 0))
end)
1 Like

try to replace adminMenu and adminFrame with this:

local adminMenu = playerGui:WaitForChild(“AdminGui”)
local adminFrame = adminMenu:WaitForChild(“Frame”)

2 Likes

I recommend checking this out StarterGui | Roblox Creator Documentation , it might solve some questions you might have. If not, feel free to ask them.

1 Like