Hello im making a game with tons of adventures and quest. I have everything i need but for some reason the save position script does not work.The script is supposed to say that is saves their position and if they rejoin game theyll be at the position they was at last.
--[[The script is supposed to say that is saves their position and if they rejoin game theyll be at the position they was at last.]]
local DataStore = game:GetService("DataStoreService"):GetDataStore("test")
game.Players.PlayerAdded:connect(function(plr)
if lastPos=nil then
local lastPos = char.HumanoidRootPart.Position
while true do
wait(1)
DataStore:SetAsync("last",tostring(lastPos))
end
else
game.Players.LocalPlayer.Character:MoveTo(lastPos)
end)
PLEASE HELP!

5 comments
http://robloxdev.com/articles/Saving-Player-Data This script needs a lot of work
dude ik about saving player data,its just when i try to do it with saving positions,it gets a little messy. Thats why i asked the question. And that link is just a review bc im not a noob
You need to align your script, this looks like something Gordon Ramsey would of yelled at if he knew Lua instead of cooking food.
so nobody can help me?
I have edited the answer.