T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
|
| 11 Jul 2012 09:41 PM |
| Not just in their Inventory but actually holding. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2012 09:48 PM |
If the player has a tool equipped, then the tool will be in the Character in the workspace. e.g
p = Worskpace.PLAYERNAME:GetChildren()
for i = 1,#p do if p[i]:IsA("Tool") then print(p[i].Name) end end
|
|
|
| Report Abuse |
|
|
T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
|
| 11 Jul 2012 10:31 PM |
^ Thanks
But I want it to be applicable to any player, not specifically [Playername]. |
|
|
| Report Abuse |
|
|
rayoma
|
  |
| Joined: 13 Nov 2009 |
| Total Posts: 1911 |
|
|
| 11 Jul 2012 10:33 PM |
Then make it a function...
function findCurrentTool(name) p = Worskpace[name]:GetChildren() for i = 1,#p do if p[i]:IsA("Tool") then return p[i] end end end |
|
|
| Report Abuse |
|
|
T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
| |
|
T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
|
| 11 Jul 2012 11:26 PM |
Okay let me be a little more specific to the scenario since this calls for a very specific script. I'm sorry if this sounds like a request but I really need this and it's really simple.
I want a script that will change the Text of the parent TextButton to the name of the currently equipped tool.
Thanks in advance. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 12:05 AM |
| This reminds Me of my old Gun Gui |
|
|
| Report Abuse |
|
|
T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
| |
|
T3XT
|
  |
| Joined: 25 Jul 2011 |
| Total Posts: 9233 |
|
| |
|
|
| 12 Jul 2012 07:36 PM |
repeat wait(0) until game.Players.LocalPlayer local TextLabel = script.Parent local Player = game.Players.LocalPlayer
while wait(0) do for i,v in pairs(Player.Character:GetChildren()) do if v:IsA("Tool") then TextLabel.Text = v.Name else TextLabel.Text = "" end end end
|
|
|
| Report Abuse |
|
|