How can I do I write this OpenFrame Code

Hi everyone I’m currently working on an Inventory System and right now I want that if I press on the Delete Button which is an ImageButton a Frame which has the same Parent as the Button should open I asked this question before but I didn’t really work now ima show the script and a pic (btw. the LocalScript is the Child of the ImageButton)

Roblox(41)

local playerSV = game:GetService("Players")
local client = playerSV.LocalPlayer
local PlayerGui = client.PlayerGui.InventoryGui
local button = script.Parent
local frame = PlayerGui.InventoryGui.InventoryFrame.EquipFrame.SureFrame
button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)

okay so since this is on the client you want to use parent:WaitForChild('name') instead of local PlayerGui = client.PlayerGui.InventoryGui if you do the . way it might error before the instances load in

1 Like

um so I’m a completly noob I replaced parent:WaitForChild(‘name’) once with local frame = PlayerGui.InventoryGui.InventoryFrame.EquipFrame.SureFrame and once I replaced it with local PlayerGui = client.PlayerGui.InventoryGui I mean I think what you said works but can u paste the hole script in if u don’t mind

local playerSV = game:GetService("Players")
local client = playerSV.LocalPlayer
local PlayerGui = client:WaitForChild('PlayerGui'):WaitForChild('InventoryGui')
local button = script.Parent
local frame = PlayerGui:WaitForChild('InventoryGui'):WaitForChild('InventoryFrame'):WaitForChild('EquipFrame'):WaitForChild('SureFrame')
button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)
1 Like

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