|
| 13 Jun 2014 11:44 AM |
Not entirely sure what I did wrong .. but i'm new to saving scripts. Output is error and 5.
Merp = script.Parent.Parent.Parent.Parent.Parent.Parent Text = script.Parent.Text Button = script.Parent
function saveScore(player, score) Merp:SaveNumber("Level", score) end
function OnClick() Button.Text = " [Saving. . .]" if Merp ~= nil then print('3') wait(3) local stats = Merp:FindFirstChild("stats") Merp:WaitForDataReady() if (stats ~= nil) then local level = stats:FindFirstChild("Level") if (Merp.stats.Level ~= nil) then saveScore(Merp, level.Value) end end
print('4') Button.Text ="[Save Complete]" else print('error') Button.Text = "[Error]" end wait(3) print('5') Button.Text = Text end
Button.MouseButton1Click:connect(OnClick)
|
|
|
| Report Abuse |
|
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 13 Jun 2014 11:57 AM |
function saveScore(player, score) Merp:SaveNumber("Level", score) end
Maybe you should use the player variable? |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2014 12:36 PM |
Same output - revised script v
Text = script.Parent.Text Button = script.Parent
function saveScore(player, score) player:SaveNumber("Level", score) end
function OnClick() Button.Text = " [Saving. . .]" if player ~= nil then print('3') wait(3) local stats = player:FindFirstChild("stats") player:WaitForDataReady() if (stats ~= nil) then local level = stats:FindFirstChild("Level") if (stats ~= nil) then saveScore(player, level.Value) end end
print('4') Button.Text ="[Save Complete]" else print('error') Button.Text = "[Error]" end wait(3) print('5') Button.Text = Text end
Button.MouseButton1Click:connect(OnClick)
|
|
|
| Report Abuse |
|
|
|
| 13 Jun 2014 12:36 PM |
| Just noticed a pointless check.. brb revising |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2014 12:40 PM |
Still same output lol .-.
Text = script.Parent.Text Button = script.Parent
function saveScore(player, score) player:SaveNumber("Level", score) end
function OnClick() Button.Text = " [Saving. . .]" if player ~= nil then print('3') wait(3) local stats = player:FindFirstChild("stats") player:WaitForDataReady() if (stats ~= nil) then print('heur') local level = stats:FindFirstChild("Level") if (level ~= nil) then saveScore(player, level.Value) print('savd') end end
print('4') Button.Text ="[Save Complete]" else print('error') Button.Text = "[Error]" end wait(3) print('5') Button.Text = Text end
Button.MouseButton1Click:connect(OnClick)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|