|
| 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 |
|
|
| |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 17 Jul 2016 08:55 PM |
Thank you soooo much!!
After working on it for hours, you have closed my case.
|
|
|
| Report Abuse |
|
|