XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:00 PM |
| Like, is their any way to make localstorages save? If their is, how? |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:01 PM |
| DataStores or HTTPService. |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:01 PM |
What do you want to save? Instances, integers, strings, booleans?
-𝒩 | Anticodist, Scripter |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
| |
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:06 PM |
| Its like an item storage, you can store items from your backpack into a box and take it out when you need it. I'm trying to make it save so when you leave it in the box then leave it doesn't go away. |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:08 PM |
| You mean if you put it in the box then leave the server, then rejoin on another server, you want the items to still be there? |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
| |
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:11 PM |
this is the storage script inside of it:
Gui = script.Parent PGui = Gui.Parent Player = PGui.Parent if Player:FindFirstChild("Backpack") == nil then Backpack = Instance.new("Backpack", Player) end Backpack = Player.Backpack Container = Gui.Container Pack = Container.Backpack Chest = Container.Chest Toggler = Gui.ToggleButton Default = Gui.DefaultButton ChestPos = Gui.ChestPos if game:GetService("Lighting"):FindFirstChild("Storage Container") == nil then Instance.new("CFrameValue", game:GetService("Lighting")).Name = "Storage Container" end Storage1 = game:GetService("Lighting")["Storage Container"] if Storage1:FindFirstChild(Player.Name) == nil then Instance.new("CFrameValue", Storage1).Name = Player.Name end LocalStorage = Storage1[Player.Name] Enabled = false CanTransfer = true SizeX = Default.Size.X.Scale SizeY = Default.Size.Y.Scale MaxX = 1 / SizeX MaxY = 1 / SizeY MaxStorage = MaxX * MaxY function ToggleContainer() if Enabled == false then Enabled = true Toggler.Text = "CLOSE" UpdateContainer() else Enabled = false Toggler.Text = "CHEST" ClearContainer() end end function Transfer(Weapon, TargetContainer) if CanTransfer == true and Weapon ~= nil and Weapon.Parent ~= nil and TargetContainer ~= nil and TargetContainer.Parent ~= nil then if TargetContainer == LocalStorage and #LocalStorage:GetChildren() >= MaxStorage then return end CanTransfer = false Weapon.Parent = TargetContainer UpdateContainer() CanTransfer = true end end function ClearContainer() local Guis = Pack:GetChildren() if #Guis > 0 then for X = 1, #Guis do Guis[X]:Remove() end end local Guis = Chest:GetChildren() if #Guis > 0 then for X = 1, #Guis do Guis[X]:Remove() end end Pack.Text = "[ BACKPACK ]" Chest.Text = "[ CHEST ]" Container.Visible = false end function UpdateContainer() ClearContainer() local Current = 0 local Weapons = Backpack:GetChildren() if #Weapons > 0 then for X = 1, #Weapons do if Weapons[X] ~= nil and Weapons[X].ClassName == "Tool" and Weapons[X]:FindFirstChild("Handle") ~= nil and Current < MaxStorage then local NewGui = Default:Clone() NewGui.Name = "PackWeaponGui" NewGui.Position = UDim2.new(SizeX * math.floor(SizeY * Current), 0, SizeY * Current - math.floor(SizeY * Current), 0) NewGui.Text = Weapons[X].Name NewGui.TextColor3 = Pack.TextColor3 NewGui.Parent = Pack NewGui.MouseButton1Click:connect(function() Transfer(Weapons[X], LocalStorage) end) NewGui.Visible = true Current = Current + 1 end end end Pack.Text = "[ BACKPACK ]=[ SHOWING " ..Current .." OF " ..#Weapons .." ]" local Current = 0 local Weapons = LocalStorage:GetChildren() if #Weapons > 0 then for X = 1, #Weapons do if Weapons[X] ~= nil and Weapons[X].ClassName == "Tool" and Weapons[X]:FindFirstChild("Handle") ~= nil and Current < MaxStorage then local NewGui = Default:Clone() NewGui.Name = "ChestWeaponGui" NewGui.Position = UDim2.new(SizeX * math.floor(SizeY * Current), 0, SizeY * Current - math.floor(SizeY * Current), 0) NewGui.Text = Weapons[X].Name NewGui.TextColor3 = Chest.TextColor3 NewGui.Parent = Chest NewGui.MouseButton1Click:connect(function() Transfer(Weapons[X], Backpack) end) NewGui.Visible = true Current = Current + 1 end end end Chest.Text = "[ CHEST ]=[ "..Current .."/" ..#Weapons .." ]" Container.Visible = true end Toggler.MouseButton1Click:connect(ToggleContainer) while true do wait(0.25) if (Player == nil or Player.Character == nil or Player.Character.Parent == nil or Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Humanoid") == nil or Player.Character.Humanoid.Health <= 0 or (Player.Character.Torso.Position - ChestPos.Value).Magnitude > 6) and CanTransfer == true then Gui:Remove() end end |
|
|
| Report Abuse |
|
|
FlyScript
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 2884 |
|
|
| 25 May 2015 03:15 PM |
| Datastores. Just save the key as their userId (not name, they can change their name) and so you can differentiate make it something like userId..Chest1 |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:16 PM |
| Do I need to make a script where players have their own code so when they leave then come back the code recognizes the player and grants the items in the box? |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:17 PM |
| What do you mean by "code"? |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:17 PM |
| How do I do this datastore thing? Is their any tutorial on wikia? |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:19 PM |
| http://wiki.roblox.com/index.php?title=Data_store |
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:20 PM |
| Also, you should use ServerStorage or ReplicatedStorage instead of lighting to store instances that aren't meant to be inside the workspace, or are needed to be put in the workspace at a later time. |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
|
| 25 May 2015 03:23 PM |
Do I do?:
local DataStore = game:GetService("DataStoreService"):GetDataStore(Chest1)
|
|
|
| Report Abuse |
|
|
|
| 25 May 2015 03:24 PM |
| No, because the argument has to be a string. |
|
|
| Report Abuse |
|
|
XzoI
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 1459 |
|
| |
|