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: Is this possible?

Previous Thread :: Next Thread 
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:19 PM
I already made the one for Global Leaderstats save using Datastore and :GetGlobalDataStore.

But the saving toold part seems to confuse me more than the first one did.
Any ideas on how to do this?

If it is, how would I do it?
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:22 PM
bump
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
06 Oct 2015 09:23 PM
link to a wiki page of what you're trying to do?


#code game["GetService"]("LoginService")["Logout"]()
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
06 Oct 2015 09:24 PM
? I think you forgot to include what you're trying to do in the original post
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
06 Oct 2015 09:24 PM
This is how I personally do it
local values = {"HighScore","Potato"}
-- ON PLAYER ENTER
local st = playerdata:GetAsync(key)
for i,v in pairs(values)do
local h = Instance.new("IntValue",player)
h.Name = v
if st then
h.Value = st[i]
print(v,st[i])
end
end


-- PLAYER LEAVE
local key = "user_"..player.userId
local s = {}
for _,v in pairs(values)do
table.insert(s,player[v].Value)
end
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:27 PM
Trying to autosave tools through a Universe-type game.
EX:In a game, get a Linked Sword, go into another Universe instance, and still have that sword.

EX2: Have a gun, change Tooltip to "Hi everyone!!", go into another Instance, and it is still "Hi everyone!!", even though it was ORIGINALLY "Hello peoplz.!" when you first got it.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
06 Oct 2015 09:29 PM
@Xon you can't use DataStore to save instances, but you can put the same tools in each game's ServerStorage and then save the name of each tool for each player in DataStore. When the player joins, just grab the correct tool from ServerStorage c:
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
06 Oct 2015 09:29 PM
for example 2, just save that info separately depending on the tool
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
06 Oct 2015 09:30 PM
^dat dont save when it shuts down
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
06 Oct 2015 09:31 PM
@MrJoe DataStore does, and ServerStorage doesn't need to save because everything is already there when the server launches
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:31 PM
Basically I want to DataStore the Player's data and have it load/save across the other games connected to the Universe.
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:34 PM
==THIS IS THE SCRIPT I USED TO SAVE LEADERSTATS ACROSS UNIVERSE GAMES=
=May be too long to read, but heres an idea=



local ShowHint = false
local Admins = {1896053}







function onXPChanged(player, Value2, Value1)
if Value2.Value>=Value1.Value * 15 then
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 = 100
player.Character.Humanoid.Health = 100

end
end
end

function onPlayerRespawned(player)
wait(2)
player.Character.Humanoid.MaxHealth = 100
player.Character.Humanoid.Health = 100
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")
local Holder = Instance.new("IntValue")
Holder.Name = "leaderstats"
Holder.Parent = player

local Value1 = Instance.new("IntValue")
Value1.Name = "Rank"
Value1.Parent = Holder

local Value2 = Instance.new("IntValue")
Value2.Name = "Rank XP"
Value2.Parent = Holder

local Value3 = Instance.new("IntValue")
Value3.Name = "Orbs"
Value3.Parent = Holder


Value1.Value = Stats[1]
Value2.Value = Stats[2]
Value3.Value = Stats[3]


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})
end
end
end)



game.Players.PlayerRemoving:connect(function(player)
local Holder1 = player.leaderstats
local Value1 = Holder1.Rank
local Value2 = Holder1["Rank XP"]
local Value3 = Holder1.Orbs
local DataStore = game:GetService("DataStoreService"):GetDataStore(player.userId)
if Holder1 then
if Value1 and Value2 and Value3 then
DataStore:SetAsync("Stats", {Value1.Value,Value2.Value,Value3.Value})
end
end
end)
end)
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
06 Oct 2015 09:36 PM
datastores can be accessed by any game in the universe.


#code game["GetService"]("LoginService")["Logout"]()
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:38 PM
So, are you saying I can use a normal DataStore Auto Save tools script that I use in my other games, and it will save across the universes WITHOUT doing any special script?
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
06 Oct 2015 09:47 PM
that's what the wiki says.


#code game["GetService"]("LoginService")["Logout"]()
Report Abuse
Xonious is not online. Xonious
Joined: 01 Jan 2009
Total Posts: 1820
06 Oct 2015 09:48 PM
I will try it, then.
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