Script doesn't work but no errors


Been at it for the last 2 hours. I need help.
Here’s the script:

– Code here works

local part = game.Workspace.Part

local GetGui = game:GetService(“StarterGui”)

local GUI = game.StarterGui.MainMenu.ScreenGui

local LessThanSymbol = GUI.Gender.LessThan

local GreatherThanSymbol = GUI.Gender.GreaterThan

local GettingGenderName = GUI.Gender

local GetRep = game.ReplicatedStorage.RemoteEvent

– Code here works^

–No Errors

– Code below me doesn’t work :confused:

GetRep.OnClientEvent:Connect(function()

GettingGenderName.Button1Down:Connect(function()

GettingGenderName.Text(“Name”)

end)

end)

This code only runs when the GetRep event is triggered from the server, if you never do that then it never runs.

1 Like

Try this.

Local ChangeText = False

Local Function event()
   ChangeText = True
   While ChangeText == True Do
    Wait(0)
     GettingGenderName.Button1Down:Connect(function()
         GettingGenderName.Text(“Name”)
         ChangeText = False
       end
    end)
  end
end

GetRep.OnClientEvent:Connect(event)  

Tell me if this doesn’t work and I’ll try give you a solution.

1 Like

Didn’t work sadly but I got the solution. It was a typo

2 Likes

This will create a new Button1Down event every wait, without cleaning old ones up.

A memory leak

1 Like

You’re getting starterGui, you want playergui if you want to change the player’s gui stuff.
so change
local GetGui = game:GetService(“StarterGui”)
to
local GetGui = game:GetService(“PlayerGui”)

tell me if it still no work

1 Like

That section of the code worked. I was trying to get a function that the Gui didn’t have

How did that not give an error?

Also you should mark your reply as the solution.

I am not sure. I had print(“hello”) like a million times to figure this out