|
| 23 Apr 2017 02:20 PM |
| How do give a weapon to only a certain person? |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 02:22 PM |
um you place it in that certain persons inventory?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2017 02:31 PM |
local name="Gomlsauresrex"
for _,player in ipairs(game.Players:GetPlayers()) do if player==game.Players[name] then --do stuff end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2017 02:44 PM |
also where should i put this script?
|
|
|
| Report Abuse |
|
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
|
| 23 Apr 2017 02:57 PM |
| Well, for one it's not finished, and two, if you're asking that, you're best of learning some basic scripting. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 02:57 PM |
| I know it's not finished. I already know the basic scripting. I'm pretty sure I could do it. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 03:05 PM |
| can someone help me please ;-;? |
|
|
| Report Abuse |
|
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
|
| 23 Apr 2017 03:06 PM |
Okay, my bad. Apologies if that came off condescending.
You'd put it wherever you want it to run in any server script. Though, making it a function that takes in the name of player and tool as parameters would be the neatest way to go about it I suppose. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 03:11 PM |
Well now that I know where to put the script, I just don't know how you could put the weapon inside a certain person's inventory.
I tried to clone the weapon and than put it inside the person's inventory, but that didn't work. |
|
|
| Report Abuse |
|
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
|
| 23 Apr 2017 03:19 PM |
| Parent the tool object to either player.Backpack or player.Character, the latter forcibly equipping it. 100% they both work. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 03:32 PM |
Sorry, this is really confusing me. I've just started like 2 months ago, I know some stuff but this is the first some i've done this. Do you mind if you help me with the script itself? |
|
|
| Report Abuse |
|
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
|
| 23 Apr 2017 03:58 PM |
| Sure. What do you have so far? |
|
|
| Report Abuse |
|
|
daireb
|
  |
| Joined: 16 Nov 2012 |
| Total Posts: 726 |
|
|
| 23 Apr 2017 03:58 PM |
for _, k in pairs(workspace:GetChildren()) do if k == game.Workspace.Part then return part end end
lol
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 04:00 PM |
I got
local name="AwesomeBrickJoe"
for _,player in ipairs(game.Players:GetPlayers()) do if player==game.Players.name. then a = game.ServerStorage.staff:Clone() -- this is the part where I am confuse at. end end |
|
|
| Report Abuse |
|
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
| |
|
| |
|
Rice_Nice
|
  |
| Joined: 12 Mar 2017 |
| Total Posts: 166 |
|
|
| 23 Apr 2017 04:13 PM |
Okay. There's a shorter way you can do it really. Forget the for loop, it's just adding to complexity.
local name = "AwesomeBrickJoe"
a = game.ServerStorage.staff:Clone() a.Parent = game.Players[name].Backpack
Treating game.Players as a table, you can find a value inside it using the 'name' variable as a key. The value found is a Player instance which contains the Backpack, PlayerGui, and so on.
The for loop meant to check every instance inside game.Players against the 'name' variable, but that's quite longwinded and unecessary tbh. Do look up generic for loops though if you haven't already.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2017 04:17 PM |
| ah I can actually understand the script you gave me. |
|
|
| Report Abuse |
|
|