RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"you need to make all of the scripts for every UI and make it very optimized"
-- server script local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local Tickets = ReplicatedStorage:WaitForChild("Tickets") -- local script in Choose Class UI local player = game:GetService("Players").LocalPlayer local classUI = player.PlayerGui:WaitForChild("ChooseClassUI") local classButtons = classUI:GetChildren() local function giveTicket(class) local ticket = Tickets:FindFirstChild(class):Clone() if ticket then ticket.Parent = player.Backpack else print("No ticket found for this class") end end for _, button in pairs(classButtons) do button.MouseButton1Click:Connect(function() giveTicket(button.Name) end) end -- server script for managing UI local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local playerGui = player:WaitForChild("PlayerGui") local screenGui = Instance.new("ScreenGui") screenGui.Name = "ChooseClassUI" screenGui.Parent = playerGui -- create UI elements local frame = Instance.new("Frame") frame.Size = UDim2.new(0.5, 0, 0.5, 0) frame.Position = UDim2.new(0.25, 0, 0.25, 0) frame.Parent = screenGui local classes = {"Class1", "Class2", "Class3"} -- replace with your classes for i, class in ipairs(classes) do local button = Instance.new("TextButton") button.Size = UDim2.new(0.3, 0, 0.1, 0) button.Position = UDim2.new(0.35, 0, 0.1 * i, 0) button.Text = class button.Name = class button.Parent = frame end end) -- Note: This script assumes that you have a model for each class ticket named after the class in a folder named 'Tickets' inside ReplicatedStorage. When a player selects a class from the Choose Class UI, they are given the corresponding ticket. If there is no ticket for the selected class, a message is printed to the console. You will need to add your own logic for eligibility checks and what happens when the ticket is used. The UI is created when a player joins the game.