How can I tell the position of the frame?

Hi everyone I’m currently working on an InventorySystem and rn I want that if I press on the Delete Button a frame opens idk ima show what I mean

Roblox(41)
So I want that if I press on the DeleteButton the SureFrame opens IK its pretty ez but idk how to do this I only know the one with script.Parent… I got a script here which is located in the DeleteButton

local button = script.Parent
local frame = game.StarterGui.InventoryGui.InventoryFrame.EquipFrame.SureFrame
button.MouseButton1Click:Connect(function()
	frame.Visible = not frame.Visible
end)

replace game.StarterGui with the PlayerGui (you will need a player variable for it)

use a MouseButton1Click event and change SureFrame.Visible to true. and don’t use game.StarterGui

i don’t think it matters if it’s frame.Visible = true or frame.Visible = not frame.Visible

(frame.Visible = not frame.Visible basically just sets the visibility of the frame to the opposite of what the visibility is)

StarterGui is NOT where you’re supposed to change the visibility, you’re changing that from where GUI is cloned over to PlayerGui each spawns according to ResetOnSpawn boolean.

what you should do is get it from one variable

--if the script is parented to ScreenGui
local GUI = script.Parent
local sure_butonz = GUI.InventoryFrame.EquipFrame.SureFrame


OR find it from PlayerGui

local playerSV = game:GetService("Players")
local client = playerSV.LocalPlayer
local GUI = client.PlayerGui.InventoryGui
local sure_butonz = GUI.InventoryFrame.EquipFrame.SureFrame 

incase you’re still clueless

local button = script.Parent
local playerSV = game:GetService("Players")
local client = playerSV.LocalPlayer
local GUI = client.PlayerGui.InventoryGui
local sure_fram = GUI.InventoryFrame.EquipFrame.SureFrame
button.Activated:Connect(function() --i prefer this over MouseButton1Click
	sure_fram.Visible = false
end)
1 Like

why are you explaining this to me like i’m a monkey? i’m not this stupid if i’m capable of helping someone on a thread then I think I know what that does, plus it does matter in this case, because he very ovbiously wants to open a confirmation menu before u delete something so setting Visible to true would be better because it would take less time and effort to write and because I assume there’s already a cancel button to set it to false also if it was a confirmation menu then it would completely block the delete button so theres no point in doing not frame.Visible.

Make up your mind already why are there like 3 different types of casing for your variables. GUI is full caps, some of ur variables are snake_case and some of your variables are camelCase. just make them all one type of casing so your code looks more readable.

i mean i dont actually prefer to stylize it based on luau general naming guide, i only do this when i collab on makin games with someone, this isn’t that necessary to do here even someone on devforum doesn’t format it right zzzzzzz

But you are helping a beginner so you should stick to one type of casing so you don’t confuse them + why would you willingly sabotage your ability to read your own code by having 7 different types of casing at once?

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