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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jan 2015 |
| Total Posts: 503 |
|
| |
|