Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I add this line to my code?(DATASTORE) NOT ANSWERED

Asked by
TrollD3 105
9 years ago

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

Answer this question