Script is not working

I created a main local script for my game, there is no errors, but the actions aren’t working (text buttons i think), maybe is the way i’m using the local script.

--local

local repdata=game:GetService("ReplicatedStorage")

local eventdata=repdata.Avatar -- avatar data

local menu=game:GetService("StarterGui").Menu -- customization gui

local clothmale=menu.ClothingFrame1

local clothfemale=menu.ClothingFrame2

local customframe=menu.CustomizeFrame

local facemale=menu.FaceFrame1

local facefemale=menu.FaceFrame2

local hud=menu.HUD

local hairmale=menu.HairFrame1

local hairfemale=menu.HairFrame2

local hats=menu.HatFrame

local malebutton=customframe.MaleButton

local femalebutton=customframe.FemaleButton

--code

femalebutton.MouseButton1Click:connect(function() --female change

clothmale.Visible=false

clothfemale.Visible=true

facemale.Visible=false

facefemale.Visible=true

hairmale.Visible=false

hairfemale.Visible=true

end)

--

malebutton.MouseButton1Click:connect(function() --male change

clothmale.Visible=true

clothfemale.Visible=false

facemale.Visible=true

facefemale.Visible=false

hairmale.Visible=true

hairfemale.Visible=false

end)

I see that you are using StarterGui when you define “menu”. You should use local menu = game.Players.LocalPlayer.PlayerGui:WaitForChild("Menu")

The wait for child is just because you are working with GUIs, and the code has the possibility of running before the items in the PlayerGui are loaded. And, everything in the StarterGui gets closed when a player joins, so you don’t actually see the GUIs in the StarterGui, you are seeing the ones in PlayerGui.

2 Likes

thank you sir!

it worked as intended.

1 Like