local plr = game.Players.LocalPlayer
local PlayerGui = plr.PlayerGui
local ClassFold = PlayerGui:WaitForChild("ClassSelectionUI")
local SelectionScreen = ClassFold.SelectionScreen.Frame.TextLabel
local PlayButton = ClassFold.SelectionScreen.Frame.TextButton
local SelectedClass = ""
local MiscTable = {}
local Module = {}
function Start(ClassFolder,ButtonPlay)
for _, v in ipairs(ClassFolder:GetChildren()) do
table.insert(MiscTable,v)
end
for i,vv in MiscTable do
if vv.Name == "Classes" then
for _,x in vv:GetChildren() do
if x.ClassName == "TextButton" then
x.MouseButton1Click:Connect(function()
SelectedClass = x.Name
SelectionScreen.Text = SelectedClass
end)
end
end
end
end
ButtonPlay.MouseButton1Click:Connect(function()
if SelectionScreen.Text ~= "Choosen Class:" then
for i,v in ClassFolder:GetChildren() do
plr:SetAttribute("Class",SelectionScreen.Text)
v.Enabled = false
end
else
print("Choose a Class")
end
end)
end
function Module:New()
Start(ClassFold,PlayButton)
end
return Module
it needs to be a direct child of StarterGui. you can fix this by changing ClassSelectionUI to a ScreenGui with ResetOnSpawn set to false, and it will function as a folder
This might work let me test this out
1 Like
Thanks that help me save another week
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
