Alright so this is a data script its a global script in ServerScriptService
local DataStore = game:GetService("DataStoreService"):GetDataStore("HahaisdeadSave32") local replicatedStorage = game:GetService("ReplicatedStorage") local saveRemote = replicatedStorage:WaitForChild("Save") local BloodAuto = replicatedStorage:WaitForChild("BloodAutoSave") --creating data game.Players.PlayerAdded:Connect(function(player) wait() local SpinSystem = player.PlayerGui:WaitForChild("SpinSystem") local folder = Instance.new("Folder", player) folder.Name = "Data" local hasgame = Instance.new("BoolValue", folder) hasgame.Name = "HasGame" local hair = Instance.new("StringValue", folder) hair.Name = "Hair" local outfit = Instance.new("StringValue", folder) outfit.Name = "Outfit" local accessory = Instance.new("StringValue", folder) accessory.Name = "Accessory" local Gender = Instance.new("StringValue", folder) Gender.Name = "Gender" local blood = Instance.new("StringValue", folder) blood.Name = "Blood" local spins = Instance.new("IntValue", folder) spins.Name = "Spins" local bloodRarity = Instance.new("StringValue", folder) bloodRarity.Name = "BloodRarity" --------------INCASE PLAYER LEAVES GAME ON THE SPINSYSTEM PART THIS WILL SHOW THE DATA THE PLAYER HAD BEFORE THEY LEFT wait() local BloodBackground = player.PlayerGui.SpinSystem.Background local BloodValue = player.Data.Blood.Value local SpinValue = player.Data.Spins.Value local rarityValue = player.Data.BloodRarity.Value --visibiliy of spin button variable local burgcol = Color3.fromRGB(160, 1, 3) local bronzecol = Color3.fromRGB(162, 82, 3) local goldcol = Color3.fromRGB(161, 161, 0) local mutantcol = Color3.fromRGB(255,0 ,0 ) local olivecol = Color3.fromRGB(65, 97, 0) local jadecol = Color3.fromRGB(7, 132, 70) local tealcol = Color3.fromRGB(0, 130, 130) local cobaltcol = Color3.fromRGB(0, 65, 130) local indigocol = Color3.fromRGB(0, 0, 255) local purplecol = Color3.fromRGB(74, 8, 140) local violetcol = Color3.fromRGB(106, 0, 106) local fuchsiacol = Color3.fromRGB(153, 0, 77) ------------------------------------------------------------------------------------------------------------------------SAME HERE local getData local success, errormsg = pcall(function() getData = DataStore:GetAsync(player.UserId) BloodBackground.Frame.BloodTitle.Text = BloodValue BloodBackground.Frame.Spinsleft.Text = "Spins left: "..SpinValue BloodBackground.Frame.Rarity.Text = rarityValue end) ---------------------------------------------------------------------------------------------- if success then print("Successfully loaded "..player.Name.."'s data!") elseif not success then -- FIRST TIME JOINING -- hasgame.Value = false print("hasgame has been changed to false") hair.Value = "Men Hair" print("hair value has been changed to men hair") outfit.Value = "Luffy's outfit" print("outfit has been changed to luffys outfit") accessory.Value = "Shades" print("accessory has been changed to shades") Gender.Value = "Male" print("gender has been changed to none") blood.Value = "Burgundy" print("blood has been set to burgundy") spins.Value = 8 rarityValue = "Common" error("Something went wrong while loading the data of "..player.Name..": "..errormsg) end end) saveRemote.OnServerEvent:Connect(function(player, val) DataStore:SetAsync(player.UserId, val) print("Successfully saved "..player.Name.."'s data!") end)
anything at all wrong with this?
saveRemote.OnServerEvent:Connect(function(player, val) DataStore:SetAsync(player.UserId, val) print("Successfully saved "..player.Name.."'s data!") end)