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: How do you give each player a different item

Previous Thread :: Next Thread 
iCosmicReaver is not online. iCosmicReaver
Joined: 17 Feb 2016
Total Posts: 115
17 Jul 2016 06:38 PM

names = {"Sword","Gun","Bow"} -- Examples

function give()
for i,v in pairs(game.Players:GetChildren()) do



-- using something along the lines of this ^ I could use math random to give them one of the listed tools in names


PROBLEM:
Now so my problem is.. How do I prevent players from getting the same tools.
Only one should have his unique item.



Report Abuse
HeIIoISteaIUsernames is not online. HeIIoISteaIUsernames
Joined: 26 Oct 2012
Total Posts: 2906
17 Jul 2016 06:41 PM
did you use math.random
Report Abuse
iCosmicReaver is not online. iCosmicReaver
Joined: 17 Feb 2016
Total Posts: 115
17 Jul 2016 06:44 PM
Read last part


Report Abuse
iCosmicReaver is not online. iCosmicReaver
Joined: 17 Feb 2016
Total Posts: 115
17 Jul 2016 08:10 PM
Bump so I got this far.. still same thing tho


names = {"Sword", "Gun","Bow"}

function give()
for i,v in pairs(game.Players:GetChildren()) do
Roles = v.Game.Role
if v.Game.Role then
if Roles.Value ~= "King" then
Roles.Value = "Waiting"
if Roles.Value == "Waiting" then
db = true

Roles.Value = names[math.random(1, #names)]




Store = game.ReplicatedStorage.List:GetChildren()
List = game.ReplicatedStorage.List


Gui = List:GetChildren()
for i = 1, # Gui do
if Gui[i].Name == v.Game.Role.Value then
Gui[i]:Clone().Parent = v.PlayerGui

wait(0.1)
db= false
end
end

end

end
end
end
end


give()



So this basically gives a msg to the player of their specific weapon.

However while testing two players may have the same class/weapons which I don't want.

So how do you edit it where as each player has gotten a different weapon (There is more than 3 just not listed)


Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
17 Jul 2016 08:35 PM
Make sure the tools are in ReplicatedStorage
Put 3 BoolValues in ReplicatedStorage and name them "SwordGiven" "GunGiven" and "BowGiven" and set them all to false

So the problem you want us to solve is preventing players from getting the same tools, so i'm assuming you only have 3 people in the server.

names={"Sword","Gun","Bow"}

function give()
for i,v in pairs(game.Players:GetChildren()) do
randomwep=names[math.random(1,#names)
val=game.ReplicatedStorage:FindFirstChild(randomwep.."Given")
if val.Value==false then
c=game.ReplicatedStorage:FindFirstChild(randomwep)
c.Parent=v.Backpack
val.Value=true
else
give()
end
end
end

That might work but obviously it's untested. Might have to tweak it a bit but you should know whats going on there.


Report Abuse
iCosmicReaver is not online. iCosmicReaver
Joined: 17 Feb 2016
Total Posts: 115
17 Jul 2016 08:55 PM
Thank you soooo much!!

After working on it for hours, you have closed my case.


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