Hello, good morning, what does that throw me that is nil the second argument in SetPrimaryPartCFrame because my global variable is nil, what am I doing wrong? I need help. I'm very stressed with this.
local DataStoreService = game:GetService("DataStoreService")
local positionStore0 = DataStoreService:GetDataStore("Position0")
local ground = game.Workspace.Ground
local function encode_cframe(cf)
return string.format(string.rep("%f ",12), cf:components())
end
local function decode_cframe(cf)
local tab = {}
for s in string.gmatch(cf, "%d+") do
table.insert(tab,tonumber(cf))
end
return CFrame.new(unpack(tab))
end
game("GetService", "Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
cframeplayer = character:GetPrimaryPartCFrame()
local get = positionStore0:GetAsync("Position0")
character:SetPrimaryPartCFrame(ground.CFrame * cframeplayer)
print(get)
character.Humanoid.Died:Connect(function()
end)
end)
end)
game("GetService", "Players").PlayerRemoving:Connect(function(player)
player.CharacterRemoving:Connect(function(character)
local set = positionStore0:SetAsync("Position0", encode_cframe(cframeplayer))
print(set)
end)
end)

5 comments
You should work on consistency a bit. On line 1 you're doing game:GetService yet on lines 19 and 35 you're doing game("GetService", "Players")
That's not the problem
My problem is that I do not know how to load the cframe of the position I keep or charge.
I never said it was. I just said you should be more consistent
There are many ways of doing things