ive got a perfectly fine datastorage set of scripts, but they dont seem to work, ive tried to do everything right, but still isnt working
https://devforum.roblox.com/t/using-google-spreadsheets-as-a-database/12658 (this is what i used)
the module and local script works fine, just seems to be the server script and MAYBE the module script (its in server script service)
the script works that when you gain money, the local script does a fire server and it gets to a few lines in the server script until line 8 and says GetDatabase is not a valid member of module script (EVENTHOUGHITIS), any help?
i tried putting the module script in lighting instead of sss but it doesnt seem to do anything besides not have the server script work, any help?
here's the server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
saveMoneyEvent = game.ReplicatedStorage.saveMoneyEvent
httpService = game:GetService("HttpService")
local function onSaveMoneyFired(player)
print ("it has arrived!")
money = player:FindFirstChild("cash")
local databaseService = game.ServerScriptService.DatabaseService --- ive considered making the module script into lighting but it doesnt seem to do anything
local globalDatabase = databaseService:GetDatabase("Global") --- heres the error
globalDatabase:PostAsync(player.Name, money.Value)
print(money.Value)
end
saveMoneyEvent.OnServerEvent:Connect(onSaveMoneyFired)
here's the module script
local scriptId = "" ---theres something here, i just removed
-- Touch anything below and you'll upset the script, and that's not a good thing.
local url = "https://script.google.com/macros/s/" .. scriptId .. "/exec"
local httpService = game:GetService'HttpService'
local module = {}
game:WaitForChild'NetworkServer'
function decodeJson(json)
local jsonTab = {} pcall(function ()
jsonTab = httpService:JSONDecode(json)
end) return jsonTab
end
function encodeJson(data)
local jsonString = data pcall(function ()
jsonString = httpService:JSONEncode(data)
end) return jsonString
end
function doGet(sheet, key)
local json = httpService:GetAsync(url .. "?sheet=" .. sheet .. "&key=" .. key)
local data = decodeJson(json)
if data.result == "success" then
return data.value
else
warn("Database error:", data.error)
return
end
end
function doPost(sheet, key, data)
local json = httpService:UrlEncode(encodeJson(data))
local retJson = httpService:PostAsync(url, "sheet=" .. sheet .. "&key=" .. key .. "&value=" .. json, 2)
local data = decodeJson(retJson)
print(retJson)
if data.result == "success" then
return true
else
warn("Database error:", data.error)
return false
end
end
function module:GetDatabase(sheet)
local database = {}
function database:PostAsync(key, value)
return doPost(sheet, key, value)
end
function database:GetAsync(key)
return doGet(sheet, key)
end
return database
end
return module

5 comments
your suppose to require the module script first
using require()
because the script thinks your indexing a instance inside the module script
god damn it i used require earlier i removed it to test something
ok it works now but its saynig money is a nil value reeeeeeeeeeee this never happens