fullajeh
|
  |
| Joined: 30 Jan 2013 |
| Total Posts: 196 |
|
|
| 11 Jul 2016 10:29 AM |
I've been trying to use Mouse.Target, but I couldn't get the parent of It. I tried In 2 ways.
First Way ------------------------------
tool=script.Parent
tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() if mouse.Target~=nil then local sel=Instance.new("SelectionBox", mouse.Target) sel.Adornee=sel.Parent local plr=sel.Parent.Parent print(plr.Name) else return end end) end)
----------------------------
Second way
----------------------------
local plr=game.Players.LocalPlayer plr.CharacterAdded:wait() local char=plr.Character tool=script.Parent
tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() if mouse.Target.Parent:FindFirstChild("Humanoid") then print(mouse.Target.Parent.Name) end end) end)
-----------------------------
|
|
|
| Report Abuse |
|
|
| |
|
fullajeh
|
  |
| Joined: 30 Jan 2013 |
| Total Posts: 196 |
|
| |
|
| |
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 11 Jul 2016 10:34 AM |
Did you get any output errors?
--game.Players.doggy00.Life:remove() error- Life is not a valid member of Player |
|
|
| Report Abuse |
|
|
fullajeh
|
  |
| Joined: 30 Jan 2013 |
| Total Posts: 196 |
|
|
| 11 Jul 2016 10:35 AM |
Nope. None at all, It just kept printing 'Workspace'.
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 10:35 AM |
| 8=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================D |
|
|
| Report Abuse |
|
|
fullajeh
|
  |
| Joined: 30 Jan 2013 |
| Total Posts: 196 |
|
| |
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 11 Jul 2016 10:40 AM |
So it prints Workspace?
This is part of your script.
local plr = sel.Parent.Parent print(plr.Name)
This must mean that sel.Parent.Parent is Workspace. I assume this isn't intentional since the variable's name is "plr".
--game.Players.doggy00.Life:remove() error- Life is not a valid member of Player |
|
|
| Report Abuse |
|
|
Ortron
|
  |
| Joined: 19 Jul 2013 |
| Total Posts: 1297 |
|
|
| 11 Jul 2016 10:40 AM |
The first script works but the tool only equips if the tool has a Handle
To fix this inside the tool properties untick the box which says requires handle
|
|
|
| Report Abuse |
|
|
fullajeh
|
  |
| Joined: 30 Jan 2013 |
| Total Posts: 196 |
|
|
| 11 Jul 2016 10:42 AM |
I've already done that, what I want the first one to do Is print out the Player's name [I'm clicking on my own torso when I spawn In]. It doesn't create the selectionbox on the torso, or anything, It prints "Workspace", so I'd assume that It thinks workspace Is the parent. How do I change that?
|
|
|
| Report Abuse |
|
|
Ortron
|
  |
| Joined: 19 Jul 2013 |
| Total Posts: 1297 |
|
|
| 11 Jul 2016 10:43 AM |
the mouse ignores the local player
i think anyway
|
|
|
| Report Abuse |
|
|