Script:
local Menu = script.Parent.Parent.Menu.ScreenGui.MainFrame function Equipped() script.Parent.Parent.Menu.ScreenGui.MainFrame:Clone() script.Parent.MainFrame.Parent.Equipped() if onEquipped() MainFrame.Parent.Parent = script.Parent.Parent.Menu.ScreenGui.MainFrame:Clone() MainFrame.Parent = player.PlayerGui end end function MainFrame:Remove() end Tool.Parent.Parent.Menu.ScreenGui.MainFrame:Connect(onEquipped) Tool.Parent.Parent.Menu.ScreenGui.MainFrame:Connect(onUnEquipped)
I noticed that this is my first time scripting, but I am trying to make a like a screen gui open a Frame which shows the image. (I think its called Frame open it Or something like that.)
And I noticed I script it very wrong. (I am kinda learning to script.)
I also somehow have a red underline error between MainFrame
Here is a picture for it.
Picture:
https://gyazo.com/e5fc7ed2fb99cf7a4eaa07d8155b8cf4
For the onEquipped() I made the GUI like when the tool is Equipped It shows the GUI frame. when it's on Or Equipped.
And the part here said onUnEquipped, This means that when the Gui is Equipped but then the player decided to UnEquipped Somehow the GUI Remove itself from the screen or I should say its gone or disappear.
So I really know that I kinda got it wrong but thank you for helping me. Also, this is my first scripting and it took me some time. I am still learning to script so thank you.
Also, please tell me the things I got wrong, so in the future, I don't get it wrong again.
For your code,
local Menu = script.Parent.Parent.Menu.ScreenGui.MainFrame function Equipped() script.Parent.Parent.Menu.ScreenGui.MainFrame:Clone() script.Parent.MainFrame.Parent.Equipped() if onEquipped() MainFrame.Parent.Parent = script.Parent.Parent.Menu.ScreenGui.MainFrame:Clone() MainFrame.Parent = player.PlayerGui end end function Remove MainFrame:Remove() end Tool.Parent.Parent.Menu.ScreenGui.MainFrame:Connect(onEquipped) Tool.Parent.Parent.Menu.ScreenGui.MainFrame:Connect(onUnEquipped)
I think at the last 2 lines you should use events like
Tool.Equipped:connect(Equipped) -- I think or Tool.Unequipped:connect(Equipped) -- either with (Equipped) or (Equipped()
I'm not exactly sure, coding at night really changes your thoughts. Anyways, hoped it helped :)