In Replicates Storage, there is a folder (named Classes) and inside that are 5 bool values named custom 1-5. Inside each of those bool values, there are 2 string values called Primary and Secondary. Im trying to make guns save into a player's custom class so they can use the gun later (im only doing the saving part). The Textbutton has the first part of the script and the remoteevents in replicated storage (the first child in ReplicatedS.) has the second part. How would I make this work? I have been racking my head day/ night to make this work. I want this to save FOR EACH PLAYER. idk if I did that though....
Textbutton script: (THIS IS A LOCAL SCRIPT)
local player = game.Players.LocalPlayer local SaveClass = game.ReplicatedStorage:WaitForChild('SaveClass') local function onClicked() SaveClass:FireServer("Bal-27 AE") -- that will send "Bal-27 AE" to the remoteevent, the remoteevent will save that stat end script.Parent.MouseButton1Click:connect(onClicked)
RemoteEvent script: (REGULAR SCRIPT. Script is inside remoteevent and The name of remoteevent is save class.) I think the error is here because it cant find primary.
local Data = game:GetService("DataStoreService"):GetDataStore("DataStore") local function SaveClass(Player, Name) Data:SetAsync(Player.userId..' Player', Name) print("success") end script.Parent.OnServerEvent:connect(SaveClass)