Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Setting Up \\--
- local DataStore2 = require(game:GetService('ServerStorage'):WaitForChild('DataStore2'))
- local starterData = {
- Skill1 = 'One';
- Skill2 = 'Two';
- Skill3 = 'Three';
- Skill4 = 'Four';
- Skill5 = 'Five';
- Skill6 = 'E';
- Skill7 = 'R';
- Skill8 = 'C';
- Skill9 = 'V';
- Sheathe = 'Q';
- Inventory = 'I';
- Settings = 'O';
- Friends = 'U';
- skillTree = 'K';
- Sprint = 'LeftControl';
- Block = 'F';
- Trees = true;
- SunRays = true;
- }
- -- The first of the DataStore2.Combine is the name of the datastore, the rest are keys.
- DataStore2.Combine("settingsDataStore" , "Skill1", "Skill2", "Skill3", "Skill4", "Skill5", "Skill6", "Skill7", "Skill8", "Skill9", "Sheathe", "Inventory", "Settings", "Friends", "skillTree", "Sprint", "Block", "Trees", "Sunrays")
- --// Functions \\--
- game:GetService('Players').PlayerAdded:Connect(function(Player)
- -- Making a table for the datastores
- local dataGet = {
- Skill1 = DataStore2("Skill1", Player);
- Skill2 = DataStore2("Skill2", Player);
- Skill3 = DataStore2("Skill3", Player);
- Skill4 = DataStore2("Skill4", Player);
- Skill5 = DataStore2("Skill5", Player);
- Skill6 = DataStore2("Skill6", Player);
- Skill7 = DataStore2("Skill7", Player);
- Skill8 = DataStore2("Skill8", Player);
- Skill9 = DataStore2("Skill9", Player);
- Sheathe = DataStore2("Sheathe", Player);
- Inventory = DataStore2("Inventory", Player);
- Settings = DataStore2("Settings", Player);
- Friends = DataStore2("Friends", Player);
- skillTree = DataStore2("skillTree", Player);
- Sprint = DataStore2("Sprint", Player);
- Block = DataStore2("Block", Player);
- Trees = DataStore2("Trees", Player);
- SunRays = DataStore2("Sunrays", Player);
- }
- -- Creating player's folders when joined and doing everything else.
- local Hotkeys = Instance.new('Folder')
- Hotkeys.Name = "Keybinds"
- Hotkeys.Parent = Player
- local Options = Instance.new('Folder')
- Options.Name = "Options"
- Options.Parent = Player
- local Stats = Instance.new('Folder')
- Stats.Name = "Stats"
- Stats.Parent = Player
- local Inventory = Instance.new('Folder')
- Inventory.Name = "Inventory"
- Inventory.Parent= Player
- for i, v in pairs(starterData) do
- if typeof(v) == 'string' then
- local strValue = Instance.new('StringValue')
- strValue.Parent = Hotkeys
- strValue.Name = i
- for i2, v2 in pairs(dataGet) do
- strValue.Value = v2:Get() or v
- for i3, v3 in pairs(Hotkeys:GetChildren()) do
- v3.Changed:Connect(function()
- i2:Set(i3.Value)
- end)
- end
- end
- elseif typeof(v) == 'boolean' then
- local boolValue = Instance.new('BoolValue')
- boolValue.Parent = Options
- boolValue.Name = i
- for i2, v2 in pairs(dataGet) do
- boolValue.Value = v2:Get() or v
- for i3, v3 in pairs(Options:GetChildren()) do
- v3.Changed:Connect(function()
- i2:Set(i3.Value)
- end)
- end
- end
- elseif typeof(v) == 'number' then
- local intValue = Instance.new('IntValue')
- intValue.Parent = Stats
- intValue.Name = i
- for i2, v2 in pairs(dataGet) do
- intValue.Value = v2:Get() or v
- for i3, v3 in pairs(Stats:GetChildren()) do
- v3.Changed:Connect(function()
- i2:Set(i3.Value)
- end)
- end
- end
- end
- end
- print(Player.Name..'\'s data has been created..')
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement