Whats wrong with this script? (Transparency and GUIs)

Hi! I am making a GUI that when you click on it, the team change GUI appears. The changing teams works fine, I just can’t get the GUI to appear when I click it, and it won’t start off as transparent. Here is the script (bearing in mind I have no idea how to code, I just experimented around lol) I also haven’t managed to figure out how it closes when you click it again.
I think I arranged the parent child thing wrong


Thank you for helping :smile:

local JoinLight = script.Parent = "JoinLight"
local Or = script.Parent = "Or"

local ChangeTeams = script.Parent = "ChangeTeams"

JoinDark.Transparency = 1
JoinLight.Transparency = 1
Or.Transparency = 1

script.Parent.MouseButton1Click:Connect(function()

JoinDark.Transparency = 0
JoinLight.Transparency = 0
Or.Transparency = 0

end)

I’m gonna take a guess here-

local b1, b2 = script.Parent.Parent:WaitForChild("JoinDark"), script.Parent.Parent:WaitForChild("JoinLight")

script.Parent.MouseButton1Down:Connect(function()
b1.Visible = not b1.Visible
b2.Visible = not b2.Visible
end)

This should be a LocalScript in the ‘ChangeTeams’ button.

1 Like

Here’s what your script should be:

local JoinLight = script.Parent.JoinLight
local Or = script.Parent.Or

local ChangeTeams = script.Parent.ChangeTeams

JoinDark.Transparency = 1
JoinLight.Transparency = 1
Or.Transparency = 1

script.Parent.MouseButton1Click:Connect(function()

JoinDark.Transparency = 0
JoinLight.Transparency = 0
Or.Transparency = 0

end)

That should fix it :slight_smile:

1 Like

Lets point out some big mistakes:

  • When using local Thing = Place, you can only use one single “=” and not 2 , like you did.
  • When saying the place of the thing, make sure that you go up (By using .Parent) until the Parent is the Parent of the thing.
  • For Graphics User Interface (GUI), it is always better to use the Visible Properties. So if Visible is true, then this Button/Frame/Text will show, and if Visible is false, then it won’t be visible.
  • There is no Properties called Transparency in ScreenGui Instances, so calling Transparency will do nothing.
  • When scripting, have the output tab visible, so if there would be any errors/mistakes, you could fix it yourself.

Here is a fixed version

local JoinLight = script.Parent.Parent:WaitForChild("JoinLight")
local JoinDark = script.Parent.Parent:WaitForChild("JoinDark")
local Or = script.Parent.Parent:WaitForChild("Or")
local ChangeTeams = script.Parent

JoinLight.Visible = false
JoinDark.Visible = false
Or.Visible = false
ChangeTeams.Visible = true

script.Parent.MouseButton1Click:Connect(function()
--   ChangeTeams.Visible = false (remove the -- at the start and this text inside the () if you want that ChangeTeams Button becomes invisible after being clicked. Otherwise delete this line)
   JoinLight.Visible = true
   JoinDark.Visible = true
   Or.Visible = true
end)
2 Likes

Hmmmmmmmmm from when a button has a Transparency property?

Thank you for helping me :smile: lol im such a bad scripter

Thank you for helping me! :smile:

1 Like

You’re just learning, not a bad scripter:)

1 Like