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

Module script, local script, datastore?

Asked by 9 years ago

Ok so, I have 3 scripts I need to know how I could send the parameter to the module script from a local script.

Local Script This has to remain a local script because I have a lostfocus() event in it. I would like to be able to use something like this

local SavedValues = require(game.ReplicatedStorage.Get)(Player)

I want to receive a table from the name of the player. This Player is NOT the local player.

Module Script 1 (Get Table) I need to have something like this but this will not work because I don't know how to send it the parameter "Player"

local SavedValues
function GetStore(Player)
local DataStore = game:GetService("DataStoreService"):GetDataStore("ApplicationTest")
local Key = "Player-"..Player.userId
SavedValues = DataStore:GetAsync(Key)
if not SavedValues then
SavedValues = "None"
end
end
GetStore()
return SavedValues

Module Script 2 I don't need this to return anything I just need it to save.

local function SaveStore(Key,SavedValues)
local DataStore = game:GetService("DataStoreService"):GetDataStore("ApplicationTest")
DataStore:SetAsync(Key, SavedValues)
end
0
This appears to be a request. alphawolvess 1784 — 9y
0
I need to know how I could send the parameter to the module script from a local script. techsquad 0 — 9y
0
if you call something in a module from a localscript you can use local things like game.Players.LocalPlayer in the module script YellowoTide 1992 — 9y
0
It says cant call datastore from client techsquad 0 — 9y
View all comments (3 more)
1
The error tells the truth, you can't use datastore with a LocalScript, you'd have to use RemoteEvents or RemoteFunctions instead W8X 95 — 9y
0
Ok techsquad 0 — 9y
0
i dont think you can send anything to a module script from a local script... dragonkeeper467 453 — 9y

Answer this question