Im trying to make a Save/load screengui option that allows you to save your position and also allows you to load back into that same position, even after rejoining the game. please help!
heres the code: Save button:
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent.DataReady == true then
player = script.Parent.Parent.Parent.Parent.Parent.Parent
player:SaveNumber("posX", player.Character.Torso.Position.X)
player:SaveNumber("posY", player.Character.Torso.Position.Y)
player:SaveNumber("posZ", player.Character.Torso.Position.Z)
h = Instance.new("Hint",script.Parent.Parent.Parent.Parent.Parent.Parent.PlayerGui)
h.Text = "Position saved."
game:GetService("Debris"):AddItem(h, 3)
else
h = Instance.new("Hint",script.Parent.Parent.Parent.Parent.Parent.Parent.PlayerGui)
h.Text = "Please wait until DataReady becomes true."
game:GetService("Debris"):AddItem(h, 3)
end
wait(.01)
script.Parent.Parent.Parent.Parent["_Load"].Visible = false
script.Parent.Parent.Parent.jumps.Visible = false
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Visible = false
end)
and
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent["position"].Visible == false then
script.Parent.Parent["position"].Visible = true
else
script.Parent.Parent["position"].Visible = false
end
end)
Load button:
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent.DataReady == true then
player = script.Parent.Parent.Parent.Parent.Parent.Parent
player.Character.Torso.CFrame = CFrame.new(Vector3.new(player:LoadNumber("posX"), player:LoadNumber("posY"), player:LoadNumber("posZ")))
h = Instance.new("Hint",script.Parent.Parent.Parent.Parent.Parent.Parent.PlayerGui)
h.Text = "Position loaded."
game:GetService("Debris"):AddItem(h, 3)
else
h = Instance.new("Hint",script.Parent.Parent.Parent.Parent.Parent.Parent.PlayerGui)
h.Text = "Please wait until DataReady becomes true."
game:GetService("Debris"):AddItem(h, 3)
end
wait(.01)
script.Parent.Parent.Parent.Parent["_Save"].Visible = false
script.Parent.Parent.Parent.jumps.Visible = false
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Visible = false
end)
and
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent["position"].Visible == false then
script.Parent.Parent["position"].Visible = true
else
script.Parent.Parent["position"].Visible = false
end
end)
Please help me out! Thanks!
