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 » Scripters
Home Search
 

is it possible to make this script save?

Previous Thread :: Next Thread 
7Mehdi is not online. 7Mehdi
Joined: 12 Jan 2015
Total Posts: 503
21 Oct 2015 08:39 PM
local player = game.Players.LocalPlayer
StarterGui = player.PlayerGui
local btn1 = script.Parent.Clothes.Frame3.Work.B
local btn2 = script.Parent.Clothes.Frame3.Work.F
local int = StarterGui.Jersey
btn1.MouseButton1Down:connect(function()
if int.Value <99 then
int.Value = int.Value +1
btn2.MouseButton1Down:connect(function()
if int.Value >1 then
int.Value = int.Value -1
end
end)
end
end)

the int.Value goes back to default 1 when a player resets, can someone help me make this save so that when a player resets the int.value doesn't go back to 1, I am willing to pay robux
Report Abuse
togov is not online. togov
Joined: 21 Apr 2010
Total Posts: 3740
21 Oct 2015 08:40 PM
Go learn datastores you nub.
http://wiki.roblox.com/index.php?title=Data_store
Report Abuse
7Mehdi is not online. 7Mehdi
Joined: 12 Jan 2015
Total Posts: 503
21 Oct 2015 08:44 PM
why won't this work!!!

local player = game.Players.LocalPlayer
StarterGui = player.PlayerGui
local btn1 = script.Parent.Clothes.Frame3.Work.B
local btn2 = script.Parent.Clothes.Frame3.Work.F
local int = StarterGui.Jersey

if player:findFirstChild'ValueSave' then
StarterGui.int.Value=player['ValueSave'].Value
end

btn1.MouseButton1Down:connect(function()
if int.Value <99 then
int.Value = int.Value +1
local s=player:findFirstChild'ValueSave' or Instance.new('IntValue',player);
s.Name="ValueSave";
s.Value=StarterGui.int.Value
btn2.MouseButton1Down:connect(function()
if int.Value >1 then
int.Value = int.Value -1
local s=player:findFirstChild'ValueSave' or Instance.new('IntValue',player);
s.Name="ValueSave";
s.Value=int.Value
end
end)
end
end)
Previous Thread :: Next Thread
Page 1 of 1

Add a Reply

ROBLOX Forum » Game Creation and Development » Scripters



Advertisement Report

Privacy Policy | Advertise with Us | Press | Contact Us | About Us | Blog | Jobs | Parents
TRUSTe Children privacy certification
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
21 Oct 2015 08:55 PM
local player = game.Players.LocalPlayer
StarterGui = player.PlayerGui
local btn1 = script.Parent.Clothes.Frame3.Work.B
local btn2 = script.Parent.Clothes.Frame3.Work.F
local int = StarterGui.Jersey
local function save(keyname,value)
local Request = Instance.new("ObjectValue");
Request.Value = player;
Request.Name = ("save");
local data = Instance.new("IntValue",Request);
data.Value = value;
data.Name = ("value");
local key = Instance.new("StringValue",Request);
key.Value = keyname;
key.Name = ("key");
Request.Parent = workspace.SaveScript;
end;
btn1.MouseButton1Down:connect(function()
if int.Value <99 then
int.Value = int.Value +1
save(tostring(player.userId).."_IntValue",int.Value)
end -- i think you ment to do this
end)
btn2.MouseButton1Down:connect(function()
if int.Value >1 then
int.Value = int.Value -1
save(tostring(player.userId).."_IntValue",int.Value)
end
end)


-- workspace.SaveScript --
local ds = game:GetService("DataStoreService"):GetDataStore("DataStore1");
script.ChildAdded:connect(function(child)
local key = child:WaitForChild("key");
local value = child:FindFirstChild("value");
if not value then value = child:WaitForChild("value");end;
ds:SetAsync(key.Value,value.Value);
end);
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
21 Oct 2015 08:58 PM
the way you had the events before, the bt2's event would not connect until the bt1's event was connected. AND it would have connected a seperate bt2 event every time bt1 was called.
Report Abuse
7Mehdi is not online. 7Mehdi
Joined: 12 Jan 2015
Total Posts: 503
21 Oct 2015 09:15 PM
thank you so much :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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