|
| 30 Jan 2015 06:22 AM |
| I know how to get things added in my inventory in game when I spawn and no one else, how do I do it for other people? |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jan 2015 06:23 AM |
| Yea I know that, but I want it for just 1 person not everyone. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 30 Jan 2015 06:52 AM |
| All I need is to add something in my friends inventory. I know how to do mine, but I don't have the script for theirs |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 06:52 AM |
Okay, put your tool somewhere (I personally like to put it in ServerStorage, your choice though)
change local tool to the path of the tool (e.g. game.ServerStorage.MyTool):: and change local vip to "the name of the player you want to give the tool to" (e.g. "SinisterDoggy")::
local tool = local vip = "" game.Players.PlayerAdded:connect(function(ply) if ply.Name == vip then t = tool:Clone() t.Parent = ply.Backpack -- This might not be "Backpack". Double check this. end end
That SHOULD do it. Just play around with it. This wasn't done in Studio so I'm not sure if I've made a mistake
PM me if you need any help. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 06:54 AM |
| For MyTool, would that be the name of the tool? |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 06:56 AM |
Yep. So if the name of your tool was 'Knife' then change it to
game.ServerStorage.Knife
or where ever it's stored. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 06:58 AM |
Do I keep Local Tool? Or delete that and add game.SeverStorage.(tool) |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:00 AM |
Right now I have local tool = game.ServerStorage(tool name) local vip = "SinisterDoggyAlt" game.Players.PlayerAdded:connect(function(ply) if ply.Name == vip then t = tool:Clone() t.Parent = ply.Backpack -- This might not be "Backpack". Double check this. end end
And SinisterDoggyAlt is my testing account, and I didn't get it. Is there anything I should change? |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:05 AM |
local tool = game.ServerStorage(tool name)
1. Have you actually put your tool name there or just put (tool name)?
2. Have you put your tool in ServerStorage? |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:07 AM |
Yes, I put the tool name in there And yes it's in server storage, cause that's what I did for mine |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:07 AM |
| Like, I put Darkheart in there since that's the name of it |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:09 AM |
So basically I have local tool = game.ServerStorage.Darkheart local vip = "SinisterDoggyAlt" game.Players.PlayerAdded:connect(function(ply) if ply.Name == vip then t = tool:Clone() t.Parent = ply.Backpack -- This might not be "Backpack". Double check this. end end
|
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:10 AM |
| Just give me a second to jump on studio and try this |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jan 2015 07:16 AM |
Okay, this worked. I missed a ) and It was creating it too fast so I made sure it waited for the players backpack to be created:
local tool = game.ServerStorage.Tool local vip = "Player" game.Players.PlayerAdded:connect(function(ply) if ply.Name == vip then t = tool:Clone() ply:WaitForChild("Backpack") t.Parent = ply.Backpack -- This might not be "Backpack". Double check this. end end) |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 30 Jan 2015 07:21 AM |
was too lazy to put possibility for more tools than one to give (ok i cant say it would have been too easy for me) capitalization shouldnt matter put player's name inside list table and tool's name as value, the same way as it is
storage = game.ServerStorage -- where the tools are in
list = { ["someguy"] = "Darkheart", ["plAyer1"] = "Tool" }
function intable(st) for p,i in pairs(list) do if p:lower() == st:lower() then return true end end return false end
function gettool(st) for p,i in pairs(list) do if p:lower() == st:lower() and storage:FindFirstChild(i) then return storage[i] end end return nil end
game.Players.PlayerAdded:connect(function(plr) if intable(plr.Name) then local tool = gettool(plr.Name) if tool then tool:clone().Parent = plr:WaitForChild("Backpack") tool:clone().Parent = plr:WaitForChild("StarterGear") end end end) |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:24 AM |
| What do I do with Player1 and someguy? |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 30 Jan 2015 07:25 AM |
| they were just example names |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:30 AM |
| SO where do I put the player name of the person i'm going to give the tool to? |
|
|
| Report Abuse |
|
|
| |
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 30 Jan 2015 07:32 AM |
| ["PLAYERNAME"] = "TOOLNAME" |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2015 07:38 AM |
can you put the exact script down the name would be SinisterDoggyAlt and tool name will be Darkheart Can you add in the name and darkheart in?
|
|
|
| Report Abuse |
|
|