Hi, I have this script here thats supposed to save the players position when they leave so when they rejoin they respawn where they left. I have no problem loading their location, but saving it is the issue. This is my script:
game.Players.PlayerRemoving:Connect(function(plr)
local pdata = plr.Data.PlayerData
local xp = pdata.PlayerX.Value
local yp = pdata.PlayerY.Value
local zp = pdata.PlayerZ.Value
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:FindFirstChild("HumanoidRootPart")
local xc = hrp.Position.X
local yc = hrp.Position.Y
local zc = hrp.Position.z
xp = xc
yp = yc
zp = zc
end)
Any help is appreciated!