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 give a weapon to only a certain person?

Previous Thread :: Next Thread 
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 02:20 PM
How do give a weapon to only a certain person?
Report Abuse
archisaurus is online. archisaurus
Joined: 07 Apr 2013
Total Posts: 403
23 Apr 2017 02:22 PM
um you place it in that certain persons inventory?


Report Abuse
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 02:24 PM
yes.
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 02:43 PM
thanks.
Report Abuse
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 02:44 PM
also where should i put this script?
Report Abuse
Rice_Nice is not online. 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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 03:05 PM
can someone help me please ;-;?
Report Abuse
Rice_Nice is not online. 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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
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 is not online. 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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
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 is not online. 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 is not online. 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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
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 is not online. Rice_Nice
Joined: 12 Mar 2017
Total Posts: 166
23 Apr 2017 04:01 PM
Daireb lol what
Report Abuse
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 04:04 PM
help
Report Abuse
Rice_Nice is not online. 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
AwesomeBrickJoe is not online. AwesomeBrickJoe
Joined: 11 Sep 2011
Total Posts: 550
23 Apr 2017 04:17 PM
ah I can actually understand the script you gave me.
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