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: Any Suggestion?

Previous Thread :: Next Thread 
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:10 AM
I have a shop system in place for an upcoming project and I wanted to know where I can store any weapons a player has bought and the weapon he has equipped so that when the round starts the weapon is cloned to the backpack so the play can use. My question is where can I store this for every player to have there own folder that has all there weapons/stuff when they join the game?
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:16 AM
bump
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:25 AM
bump #2
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:29 AM
bump #3
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:36 AM
bump #4
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:42 AM
bump #5
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 12:58 AM
bump #6
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 01:14 AM
bump #7
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 01:19 AM
so many bumps... bump #8
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 01:53 AM
bump #9
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 01:57 AM
bump #10 Officially considered spam..
Report Abuse
Andyliu5000 is not online. Andyliu5000
Joined: 02 Nov 2013
Total Posts: 969
11 Jul 2016 02:26 AM
I'll just help you out with this. So first of all, we'll need a Server script to store everyone's data. Let's create a table:

local SessionData = {}

Now we want players to have their own table when they join the game. We can make a tables inside this table for them when they join.

game:GetService("Players").PlayerAdded:connect(function(newPlr)
SessionData[newPlr.Name] = {}
end)

Now we can create a function to update their data whenever they buy something:

function UpdatePlrData(Plr, Value)
table.insert(SessionData[Plr.Name], Value)
end

You can now use this function whenever someone buys a weapon. Beware that, if they buy the weapon twice, they'll get it twice so you may need to tweak that. You can store the name of the gun.

Now we want to give everyone their weapons. Assuming that the guns are stored in ServerStorage, we can create a function:

function EquipPlrs()
for i,v in pairs(game:GetService("Players"):GetChildren()) do
for i2,v2 in pairs(SessionData[v.Name]) do
game:GetService("ServerStorage"):FindFirstChild(v2):Clone().Parent = v.Backpack
end
end
end

And I hope you know how to make a function to remove it once the round ends.
Report Abuse
leomesa is not online. leomesa
Joined: 11 Apr 2014
Total Posts: 1029
11 Jul 2016 01:19 PM
Ah ok Tables got it. Thanks so much!
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