So, im making a character creation system and i need to get a player answer by an GUI. I did it but I feel its kinda wrong.
local Gui = script.ScreenGui
local Character = {}
Character.new = function(player:Player)
local Gui = Gui:Clone()
local Background = Gui.Background
local MainFrame = Background.Frame
Gui.Parent = player.PlayerGui
local Gender = nil
MainFrame.Male.MouseButton1Click:Connect(function()
Gender = "Male"
Gui:Destroy()
end)
MainFrame.Female.MouseButton1Click:Connect(function()
Gender = "Female"
Gui:Destroy()
end)
repeat task.wait() until Gender ~= nil
print(Gender)
end
return Character
Any suggestions on how to improve?