Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a Gui Menu tool where players open it and shows the Gui?

Asked by
dog6779 25
6 years ago

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.

0
dude.... just make the shop invisible then if you clicked the open thingy make it visible and change the text to close, another way is put the GUI in lighting then clone it out when a player click on that open button MineBlow111 39 — 6y
0
Umm..I am not a dude I am a girl. And that was kinda rude so umm..and your not helping at all. dog6779 25 — 6y

1 answer

Log in to vote
0
Answered by
vkax 85
6 years ago
Edited 6 years ago

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 :)

Ad

Answer this question