br45entei
|
  |
| Joined: 06 Nov 2010 |
| Total Posts: 1058 |
|
|
| 03 Nov 2011 06:34 PM |
#I have this script set-up to print output as a message to the player.PlayerGui so that the player (Me) can see the OutPut during gameplay. the output tells me that "PositionInstance" equals nil, when I know it shouldn't. Can any of you help?
wait(2) player = script.Player.Value SaveGui = script.Gui.Value.Save LoadGui = script.Gui.Value.Load
function Save() if player.DataReady == false then SaveGui.TextColor3 = Color3.new(1, 0, 0) wait(1) SaveGui.TextColor3 = Color3.new(1, 1, 1) return end positionsave = script.Gui.Value.CurrentPos.PositionOfPlayer succ, ret = pcall(function() player:SaveInstance("TorsoPosition", positionsave.Value) if succ then message = Instance.new("Message", player.PlayerGui) message.Text = string.format("Saved Position: %s, %s, %s", math.floor(positionsave.Value.X), math.floor(positionsave.Value.Y), math.floor(positionsave.Value.Z)) print("Successfully saved") wait(4) message.Parent = nil message = nil else print("Error Saving: '"..tostring(ret).."'.") message = Instance.new("Message", player.PlayerGui) message.Text = "An Error Ocured: '"..tostring(ret).."'." wait(4) message.Parent = nil message = nil end end) end
function Load() positionload = script.Gui.Value.CurrentPos.PositionOfPlayer if player.DataReady == false then LoadGui.TextColor3 = Color3.new(1, 0, 0) wait(1) LoadGui.TextColor3 = Color3.new(1, 1, 1) return end succ2, ret2 = pcall(function() PositionInstance = player:LoadInstance("TorsoPosition") if succ2 then if PositionInstance then print("Successfully Loaded") player.Character.Torso.CFrame = PositionInstance.Value positionload.Value = PositionInstance.Value else pcall(function() message = Instance.new("Message", player.PlayerGui) message.Text = "An Error Ocured(Load2): '"..tostring(ret2).."'." wait(4) message.Parent = nil message = nil end) end else pcall(function() message = Instance.new("Message", player.PlayerGui) message.Text = "An Error Ocured(Load1): '"..tostring(ret2).."'." wait(4) message.Parent = nil message = nil end) end end) end
SaveGui.MouseButton1Up:connect(Save) LoadGui.MouseButton1Up:connect(Load)
print("Script 'game."..script:GetFullName().."' has succsessfully loaded up with no starting errors.") |
|
|
| Report Abuse |
|
|
| 03 Nov 2011 06:44 PM |
BLOODY HELL THAT'S SOME NICE ALT +255-ING
-I will change Roblox forever. You will see soon. |
|
|
| Report Abuse |
|
br45entei
|
  |
| Joined: 06 Nov 2010 |
| Total Posts: 1058 |
|
|
| 03 Nov 2011 06:47 PM |
| ...Thanks, I guess. I figured out that I was saving the .Value of the position instance, instead of the instance itself, so I'm off to test it again. |
|
|
| Report Abuse |
|