My game is supposed to have 3 save slots so that people can retrieve their previous data upon playing again. When the player clicks a slot to load, it teleports them to the main game and depending on which slot they chose, a SetTeleportSetting function is inputted so that in the main game, a GetTeleportSetting function will be used to determine which slot the player chose and give them the appropriate data from that slot.
This is the script.
script.Parent.MouseButton1Up:connect(function() --When the player clicks this, the script activates.
TeleportService:Teleport(561825470, player) --Teleports the player to another game.
if saveNum.Value == 1 then
SetTeleportSetting(player.UserId, "save1") --If the button chosen was slot 1, the value "save1" will be used and when the player enters the main game, a GetTeleportSetting function is used to retrieve that "save1" value and then determine that the player chose the 1st slot. The UserId is used as the key.
elseif saveNum.Value == 2 then
SetTeleportSetting(player.UserId, "save2") --Same as before, just with different slots.
elseif saveNum.Value == 3 then
SetTeleportSetting(player.UserId, "save3") --You get the idea.
else
print("Error") --Used if for some odd reason, the values are anything other than 1, 2, and 3.
end
end)
Why doesn't this work? Can anybody identify the error in my script or give me a better method of going about what I want to accomplish?
