make a roblox server side text button script where when clicked it will add an…
- User
User: make a roblox server side text button script where when clicked it will add an value called LLM_Model inside the player if doesnt exist and it will make it the value in the textbox inside the frame where the TextButton is inside of too. Assistant: This script assumes you have a
TextButtoninside aFramewhich also contains aTextBox. The script will check if a player's data contains theLLM_Modelvalue. If not, it creates it. Then it updates theLLM_Modelvalue with the text from the TextBox.lualocal Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Assuming this script is a child of the Frame containing the TextButton and TextBox local frame = script.Parent local textBox = frame:FindFirstChild("TextBox") -- Replace "TextBox" with your TextBox's name local textButton = frame:FindFirstChild("TextButton") -- Replace "TextButton" with your TextButton's name if not textBox or not textButton then warn("Error: TextBox or TextButton not found within the Frame.") return end textButton.MouseButton1Click:Connect(function() local player = Players:GetPlayerFromCharacter(game.Players.LocalPlayer.Character) if not player then return end local playerData = player:WaitForChild("leaderstats", 10) -- Waits up to 10 seconds for leaderstats to load if not playerData then --If leaderstats doesn't exist after 10 seconds, create a new one playerData = Instance.new("Folder") playerData.Name = "leaderstats" playerData.Parent = player end local LLMModelValue = playerData:FindFirstChild("LLM_Model") if LLMModelValue then -- Update existing value LLMModelValue.Value = textBox.Text else -- Create new value LLMModelValue = Instance.new("IntValue") -- Or StringValue depending on your needs LLMModelValue.Name = "LLM_Model" LLMModelValue.Value = textBox.Text LLMModelValue.Parent = playerData end end) - Assistant