I want to get this working so i can get one of my games hopefully out soon
I cant seem to figure out how to make this fully work
I have look for a solution on the developer hub and could not find one.
if any one could help me figure out what i did wrong and provide feed back and tips that would much apreacated
here is the main datastore script code
Select me for the main code
local datastoreservice = game.DataStoreService
local moneydatastore = datastoreservice:GetDataStore("playersfunds","playerid")
local housewhitlist = datastoreservice:GetDataStore("guestlist","playerid")
local ammodatastore = datastoreservice:GetDataStore("playersammmostockpile","playerid")
local resourcesdatastore = datastoreservice:GetDataStore("playersresources","playerid")
local ammotable = {}
local pid = ""
local potatotable = {}
local upid = ""
do
-- This is your secret 67-bit key (any random bits are OK)
local Key53 = 8186484168865098
local Key14 = 4887
local inv256
function encode(str)
if not inv256 then
inv256 = {}
for M = 0, 127 do
local inv = -1
repeat inv = inv + 2
until inv * (2*M + 1) % 256 == 1
inv256[M] = inv
end
end
local K, F = Key53, 16384 + Key14
return (str:gsub('.',
function(m)
local L = K % 274877906944 -- 2^38
local H = (K - L) / 274877906944
local M = H % 128
m = m:byte()
local c = (m * inv256[M] - (H - M) / 128) % 256
K = L * F + H + c + m
return ('%02x'):format(c)
end
))
end
function decode(str)
local K, F = Key53, 16384 + Key14
return (str:gsub('%x%x',
function(c)
local L = K % 274877906944 -- 2^38
local H = (K - L) / 274877906944
local M = H % 128
c = tonumber(c, 16)
local m = (c + (H - M) / 128) * (2*M + 1) % 256
K = L * F + H + c + m
return string.char(m)
end
))
end
end
script.prlrevome.OnServerEvent:Connect(function(sunshine,gumdrops)
print(sunshine,gumdrops)
local splitdata = string.split(gumdrops," ")
print(splitdata)
for dataid,data in pairs(splitdata) do
table.insert(ammotable,dataid,data)
end
print(ammotable)
pid = sunshine.UserId
wait(.1)
ammodatastore:SetAsync(pid,ammotable)
end)
game.Players.PlayerAdded:Connect(function(player)
local geter = ammodatastore:GetAsync(tostring(player.UserId))
print(geter)
print("working")
end)
script.RemoteEvent.OnServerEvent:Connect(function(plr,plrid,datatable)
print(datatable)
for dataid,data in pairs(datatable) do
table.insert(ammotable,dataid,data)
end
print(ammotable)
pid = plrid
end)
repeat wait() until pid ~= ""
ammodatastore:SetAsync(pid,ammotable)
wait(1)
pid = ""