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

Why isnt this replicatedStorage / DataStore script working?

Asked by
TrollD3 105
9 years ago

In Replicated Storage, there is a folder (named Classes) and inside that are 5 bool values named custom 1-5(customs 1,2,3,etc..). I have a textbutton that has a local script that is supposed to save the name of a gun into a primary(string value) which is inside each custom bool value. Inside ReplicatedStorage there is remoteevents that saves the data to the customs, but I dont think I did it right. I also want it to save for each player that does it. There is a script in server script storage that tells the remote events to save it. I just want it to save the name of the textbutton into primary.

Textbutton 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)

Server Script Storage SCript:

local Data = game:GetService("DataStoreService"):GetDataStore("DataStore")
local function SaveClass(Player, Name)
Data:SetAsync(Player.userId..' Player', Name)
print("success")
end
game.ReplicatedStorage.SaveClass.OnServerEvent:connect(SaveClass)
0
How is it not working? Is the output not printing out "success?" Any errors? Try and give the player the weapon using the saved string from your stored data. Redbullusa 1580 — 9y

Answer this question