So, I made this script, well me and my friend BUT when i try to load it in inside studio and didn't work. However when my friend tries it, it works for him. Any help? Also API services are enabled
-- Server Script local ds = game:GetService("DataStoreService"):GetDataStore("YourDataStore") local plrs = game:GetService("Players") default = { reb = 0, pts = 0, ast = 0, banned = false } _G.sessionData = {} local sesData = _G.sessionData function setupData(key) print("Setting up plr data") local succ, data = pcall(function() return ds:GetAsync(key) end) if succ and not data == nil then sesData[key] = data else ds:SetAsync(key, default) sesData[key] = default print("New player") end end game.Players.PlayerAdded:connect(function(plr) local key = plr.UserId setupData(key) local data = sesData[key] if data.banned == true then print(key, "is banned.") plr:Kick("You are banned:", data.banId) end end) local function returnd(plr, key) local toRet = sesData[key] if toRet == nil then return nil end print("He is here") return toRet end game.ReplicatedStorage.RetrieveData.OnServerInvoke = returnd
Local
-- Local Script local PF = game:GetService("ReplicatedStorage").Players local AST = script.Parent.ForEveryone.Cater.ECT.Players.StatClone.AST local PTS = script.Parent.ForEveryone.Cater.ECT.Players.StatClone.PTS local REB = script.Parent.ForEveryone.Cater.ECT.Players.StatClone.REB local NAME = script.Parent.ForEveryone.Cater.ECT.Players.StatClone.NAME local PlayerFrame = script.Parent.ForEveryone.Cater.ECT.Players delay(1, function() local data = game.ReplicatedStorage.RetrieveData:InvokeServer(game.Players.LocalPlayer.UserId) if PF:FindFirstChildWhichIsA("StringValue") then local folderstats = Instance.new("Folder",PlayerFrame) folderstats.Name = game.Players.LocalPlayer.Name local NameClone = NAME:Clone() NameClone.Parent = folderstats NameClone.Text = game.Players.LocalPlayer.Name NameClone.Visible = true NameClone.TextScaled = true local AstClone = AST:Clone() AstClone.Parent = folderstats AstClone.Text = data.ast AstClone.Visible = true local PtsClone = PTS:Clone() PtsClone.Parent = folderstats PtsClone.Visible = true PtsClone.Text = data.pts local RebClone = REB:Clone() RebClone.Parent = folderstats RebClone.Visible = true RebClone.Text = data.reb end end)
ps. if I did something wrong or what ever be sure to leave a comment.