I want to add a line that saves the name of the textbutton to a value when its clicked.
Textbutton:
local player = game.Players.LocalPlayer gun = script.Parent.Name local SaveClass = game.ReplicatedStorage:WaitForChild('SaveClass') local function onClicked() SaveClass:FireServer("..gun..") -- that will send "Bal-27 AE" to the remoteevent, the remoteevent will save that stat end script.Parent.MouseButton1Click:connect(onClicked)
Server Script Storage :
local Data = game:GetService("DataStoreService"):GetDataStore("DataStore") local function SaveClass(Player, Name) Data:SetAsync(Player.userId..' Player', Name) end game.ReplicatedStorage.SaveClass.OnServerEvent:connect(SaveClass) if game.StarterGui.ScreenGui.ASSAULT.Bal27 then -- its incomplete I want it to say if the Textbutton is -- clicked , then it would change AND SAVE the value seen below. game.ReplicatedStorage.Classes.Custom1.Primary.Value = "Name of the textbutton" -- would depend on above. end