Hello, I have been trying to make a RPG game but the datastore2 just don’t work!
There’s no errors and it prints fine
Edit: i’m new to datastore2 and i don’t know much
game:GetService('Players').PlayerAdded:Connect(function(Player)
PlayerData = DataStore2('PlayerData', Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Data = Instance.new('Folder')
Data.Name = 'Data'
Data.Parent = Player
local Race = Instance.new('StringValue')
Race.Value = 'Human'
Race.Name = 'Race'
Race.Parent = Data
local Weapon = Instance.new('StringValue')
Weapon.Value = 'Fist'
Weapon.Name = 'Weapon'
Weapon.Parent = Data
local Mana = Instance.new('IntValue')
Mana.Value = 0
Mana.Name = 'Mana'
Mana.Parent = Data
local Hunger = Instance.new('IntValue')
Hunger.Value = 100
Hunger.Name = 'Hunger'
Hunger.Parent = Data
local Thirst = Instance.new('IntValue')
Thirst.Value = 100
Thirst.Name = 'Thirst'
Thirst.Parent = Data
local SpeedBoost = Instance.new('IntValue')
SpeedBoost.Value = 0
SpeedBoost.Name = 'SpeedBoost'
SpeedBoost.Parent = Data
local Path = Instance.new('StringValue')
Path.Value = 'None'
Path.Name = 'Path'
Path.Parent = Data
local DamageBoost = Instance.new('IntValue')
DamageBoost.Value = 0
DamageBoost.Name = 'DamageBoost'
DamageBoost.Parent = Data
local Silver = Instance.new('IntValue')
Silver.Value = 0
Silver.Name = 'Silver'
Silver.Parent = Data
Tablee = {
Silver.Value;
DamageBoost.Value;
Path.Value;
SpeedBoost.Value;
Thirst.Value;
Hunger.Value;
Race.Value;
Weapon.Value;
Mana.Value;
}
PlrTable = PlayerData:Get(Tablee)
for i, v in pairs(Tablee) do
print(v..'-'..i)
end
end)
game.Players.PlayerRemoving:Connect(function()
PlayerData:Set(PlrTable) -- this saves the data
end)