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
 

Re: Universal Tool Save

Previous Thread :: Next Thread 
bluebird1287 is not online. bluebird1287
Joined: 16 Jun 2011
Total Posts: 4202
23 Dec 2014 02:05 PM
What I need is a script that can fit in with the script I provide to make it so that not only statistics, but also the players gear travels with them to a new game that's linked 'universally' to the beginning game.


--Ex: I enter a game, step on a pad, get teleported, my stats and weapons travel with me--





local ShowHint = false -- dont change
local Admins = {22342342} -- change to your UserID







function onXPChanged(player, Value2, Value1)
if Value2.Value>=Value1.Value * 25 then -- change 9 to how much exp you want to for a person to level up
Value2.Value = 0
Value1.Value = Value1.Value + 1
end
end

function onLevelUp(player, XP, level)
if player.Character~=nil then
for i = 1,5 do
player.Character.Humanoid.MaxHealth = player.leaderstats.Level.Value * 20 -- change 30 how much HP you want per level up
player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth

end
end
end

function onPlayerRespawned(player)
wait(2)
player.Character.Humanoid.MaxHealth = player.leaderstats.Level.Value * 20 -- change 30 how much HP you want per level up
player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth
end


game.Players.PlayerAdded:connect(function(player)
local DataStore = game:GetService("DataStoreService"):GetDataStore(player.userId)
if DataStore:GetAsync("Stats") == nil then
DataStore:SetAsync("Stats", {1,0,0})
end

local Stats = {1,0,0}
Stats = DataStore:GetAsync("Stats")
-- dont touch anything above. Below you can change to names you want for each stat.
local Holder = Instance.new("IntValue")
Holder.Name = "leaderstats"
Holder.Parent = player

local Value1 = Instance.new("IntValue")
Value1.Name = "Lvl" -- change to name you want
Value1.Parent = Holder

local Value2 = Instance.new("IntValue")
Value2.Name = "XP" -- change to name you want
Value2.Parent = Holder

local Value3 = Instance.new("IntValue")
Value3.Name = "Gold" -- change to name you want
Value3.Parent = Holder

local Value4 = Instance.new("IntValue")
Value4.Name = "Tokens"
Value4.Parent = Holder

local Value5 = Instance.new("IntValue")
Value5.Name = "Gems"
Value5.Parent = Holder


Value1.Value = Stats[1]
Value2.Value = Stats[2]
Value3.Value = Stats[3]
Value4.Value = Stats[4]
Value5.Value = Stats[5]


Value2.Changed:connect(function() onXPChanged(player, Value2, Value1) end)
Value1.Changed:connect(function() onLevelUp(player, Value2, Value1) end)

player.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(player)


while player ~= nil do
wait(15)
DataStore:SetAsync("Stats", {Value1.Value,Value2.Value,Value3.Value,Value4.Value,Value5.Value})
end
end
end)



game.Players.PlayerRemoving:connect(function(player)
local Holder1 = player.leaderstats
local Value1 = Holder1.Lvl -- change to name of stat if changed
local Value2 = Holder1.XP -- change to name of stat if changed
local Value3 = Holder1.Gold -- change to name of stat if changed
local Value4 = Holder1.Tokens
local Value5 = Holder1.Gems
local DataStore = game:GetService("DataStoreService"):GetDataStore(player.userId)
if Holder1 then
if Value1 and Value2 and Value3 and Value4 and Value5 then
DataStore:SetAsync("Stats", {Value1.Value,Value2.Value,Value3.Value,Value4.Value,Value5.Value})
end
end
end)
end)
Report Abuse
bluebird1287 is not online. bluebird1287
Joined: 16 Jun 2011
Total Posts: 4202
23 Dec 2014 02:07 PM
Stat part works, there is no tool info yet.
Report Abuse
bluebird1287 is not online. bluebird1287
Joined: 16 Jun 2011
Total Posts: 4202
23 Dec 2014 02:10 PM
bump
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