generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Save script problems

Previous Thread :: Next Thread 
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 11:56 AM
bump
Report Abuse
Trioxide is not online. 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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 12:36 PM
Just noticed a pointless check.. brb revising
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
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
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 12:53 PM
bump1
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 01:11 PM
bump2
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 01:23 PM
bump3
Report Abuse
MarsPwnsAll is not online. MarsPwnsAll
Joined: 10 Jul 2011
Total Posts: 314
13 Jun 2014 01:35 PM
bump4
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image