on my script, i wrote plr.Character several times, but the Output gave me an error ONLY at line 5?!?!?!?!???!!
but my script, :
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local CFrameDataStore = DSS:GetDataStore("CFrameDataStore")
Players.PlayerAdded:Connect(function(plr)
plr.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrameDataStore:GetAsync(plr.UserId)
end)
Players.PlayerRemoving:Connect(function(plr)
CFrameDataStore:SetAsync(plr.UserId, plr.Character:FindFirstChild("HumanoidRootPart").CFrame)
end)
game:BindToClose(function()
for i, plr in pairs(Players:GetPlayers()) do
CFrameDataStore:SetAsync(plr.UserId, plr.chh:FindFirstChild("HumanoidRootPart").CFrame)CFrameDataStore:SetAsync(plr.UserId, plr.Character:FindFirstChild("HumanoidRootPart").CFrame)
end
end)
yes, i did but did not work for me, and the output says that i forgot to enable the API Setting. i thought there was an error but let me turn it on and test the script
Then you can do the same thing, but with the rotation. Just switch some things out. Also, while loading the data, set each individual value, otherwise it will error. Like this:
local data = CFrameDataStore:GetAsync(plr.UserId)
plr.Character:FindFirstChild("HumanoidRootPart").CFrame.X = data[1]
plr.Character:FindFirstChild("HumanoidRootPart").CFrame.X = data[2]
plr.Character:FindFirstChild("HumanoidRootPart").CFrame.X = data[3]