So I’ve written a script where a Frame will appear after clicking a button but it doesn’t,I have three different scripts but most of them are the same so here’s one of them.
I tried to change the script until it worked,now the original frame WILL disappear but the target frame won’t appear.
The other two frames are not visible fyi.
FYI again,the original frame is activated from a prompt
local AvaFrame = script.Parent.Parent.Avatar
local Button = script.Parent.Exit
local Avatar = AvaFrame.AvatarItems
local Pass = AvaFrame.Gamepasses
local IG = AvaFrame.InGame
local PassFrame = AvaFrame.Parent.Gamepass
local IGF = AvaFrame.Parent.InGame
Button.MouseButton1Down:Connect(function()
if IGF.Visible then
IGF.Visible = false
end
end)
Avatar.MouseButton1Down:Connect(function()
if IGF.Visible then
IGF.Visible = false
end
end)
Avatar.MouseButton1Down:Connect(function()
if AvaFrame.Visible then
AvaFrame.Visible = true
end
end)
Pass.MouseButton1Down:Connect(function()
if PassFrame.Visible then
PassFrame.Visible = true
end
end)
Pass.MouseButton1Down:Connect(function()
if IGF.Visible then
IGF.Visible = false
end
end)
Can you send a picture of the Explorer?
Or try to be more specific about which frame is the “original frame” and what is the “target frame”.
And if you get any errors in the output send a picture or just copy + paste them.
No errors,So there are three frames in a GUI,Frame 1,Frame 2 and Frame 3
There’s now a button in frame 1 which should activate frame 2 (Button-IG,Frame 2-IGF)
Frame 1 also has another button to activate frame 3 (Button-Pass,Frame 3-PassFrame)
now when I press either of them, the GUI disappears but none of the 'targeted ’ frames (frame 2/3) appears]
How is it suppose to know if IGF,AvaFrame,PassFrame.Visible is set to true or false?
Guess IGF can’t become visible if it’s always set to false, am I right?
Unless you have another script that makes it visible again.
Here try this script, it might work.
---Variables
local AvaFrame = script.Parent.Parent.Avatar
local Button = script.Parent.Exit
local Avatar = AvaFrame.AvatarItems
local Pass = AvaFrame.Gamepasses
local IG = AvaFrame.InGame
local PassFrame = AvaFrame.Parent.Gamepass
local IGF = AvaFrame.Parent.InGame
--Functions
Button.MouseButton1Down:Connect(function()
if IGF.Visible == true then
IGF.Visible = false
else if IGF.Visible == false then
IGF.Visible = true
end
end
end)
--Fucntion 2
Avatar.MouseButton1Down:Connect(function()
if IGF.Visible == true then
IGF.Visible = false
else if IGF.Visible == false then
IGF.Visible = true
end
end
end)
--Fucntion 3
Avatar.MouseButton1Down:Connect(function()
if AvaFrame.Visible == true then
AvaFrame.Visible = false
else if AvaFrame.Visible == false then
AvaFrame.Visible = true
end
end
end)
--Fucntion 4
Pass.MouseButton1Down:Connect(function()
if PassFrame.Visible == true then
PassFrame.Visible = false
else if PassFrame.Visible == false then
PassFrame.Visible = true
end
end
end)
--Fucntion 5
Pass.MouseButton1Down:Connect(function()
if IGF.Visible == true then
IGF.Visible = false
else if IGF.Visible == false then
IGF.Visible = true
end
end
end)
I am not that good at scripting so the script might not work that well.
Feel free to edit it so it suits your style or fix your problem.
It does detect that actually. The GuiBase.Visible Returns either true or false, and what you are checking is basically if true == true then which is not wrong in any way, but not necessary at all.
No, setting a value once in a script doesn’t mean it would “always” be false. However, in @OP’s post, he hides the frame only when it is false.
Here, you have stacked two if commands, which was not really necessary and increases cluster, which could easily have been solved by using elseif.
This part essentially does nothing, as it shows the frame when it is already showing. I’m really confused about what you are trying to do… can you send a picture of the explorer and the GUI you are trying to handle?
local AvaFrame = script.Parent
local Button = script.Parent.Exit
local Avatar = AvaFrame.AvatarItems
local Pass = AvaFrame.Gamepasses
local IG = AvaFrame.InGame
local PassFrame = AvaFrame.Parent.Gamepass
local IGF = AvaFrame.Parent.InGame
Button.MouseButton1Down:Connect(function()
if AvaFrame.Visible == false then
AvaFrame.Visible = true
else
AvaFrame.Visible = false
end
end)
Pass.MouseButton1Down:Connect(function()
if PassFrame.Visible == true then
PassFrame.Visible = false
else
PassFrame.Visible = true
end
end)
Pass.MouseButton1Down:Connect(function()
if AvaFrame.Visible == false then
AvaFrame.Visible = true
else
AvaFrame.Visible = false
end
end)
IG.MouseButton1Down:Connect(function()
if AvaFrame.Visible == false then
AvaFrame.Visible = true
else
AvaFrame.Visible = false
end
end)
IG.MouseButton1Down:Connect(function()
if IGF.Visible == true then
IGF.Visible = false
else
IGF.Visible = true
end
end)
Basically,I duplicated the scripts to three different GUIs and fixed some script errors but not the locals one.
What happened is that I forgot the locals back to its own GUI.
I might be having problems with explaining so here’s the difference.
Now:
local AvaFrame = script.Parent
local Button = script.Parent.Exit
local Avatar =scipt.Parent.AvatarItems
local Pass = script.ParentGamepasses
local IG =script.Parent.InGame
local PassFrame = AvaFrame.Parent.Gamepass
local IGF = AvaFrame.Parent.InGame
Before:
local AvaFrame = script.Parent
local Button = script.Parent.Exit
local Avatar = AvaFrame.AvatarItems
local Pass = AvaFrame.Gamepasses
local IG = AvaFrame.InGame
local PassFrame = AvaFrame.Parent.Gamepass
local IGF = AvaFrame.Parent.InGame
Now look back at my scripts,found the error?
Edit:how do I make the coding look coloured like studio lol,I want to know pls help