Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 09 Nov 2012 12:42 PM |
What does findpartonray do and if someone can explain this script:
tool = script.Parent tool.Equipped:connect(function(mouse) user = tool.Parent mouse.Button1Down:connect(function()
ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300) hit, position = game.Workspace:FindPartOnRay(ray, user) humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(30) end
distance = (position - tool.Handle.CFrame.p).magnitude rayPart = Instance.new("Part", user) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("Bright red") rayPart.Transparency = 0.5 rayPart.Anchored = true rayPart.CanCollide = false rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2)
game.Debris:AddItem(rayPart, 0.1) end) end) |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 01:20 PM |
ray is a raycast between the handle of your tool and the hit position of your mouse.
:findPartOnRay() returns the first part that gets hit by the ray. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 09 Nov 2012 02:06 PM |
| I dont get the findpartonray() line explain it pl0x? |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 02:08 PM |
| Or you could be a programmer and look at the documentation on the wiki... |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 09 Nov 2012 02:09 PM |
| Or u could stop comming with stuff that doesent help.And please no complains i said that. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 02:12 PM |
I'm pretty sure I just told you where you could get your information. You're welcome. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 09 Nov 2012 02:49 PM |
| As i said, no spam please, neither on this, back to topic. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 02:58 PM |
Actually as AFF said, it's all on the wiki :/ but however, here it comes :
game.Workspace:findPartOnRay(ray, user)
:findPartOnRay() is a method that requires 2 variables ; the ray, (created with ray.new()) and the character (called user in the script)
it returns 2 things, the part it hit and the vector3 position of the hit.
|
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 03:11 PM |
| I'm pretty sure the implied rule of this forum is to do research BEFORE you post. This means your post is spam. My help post is not spam. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 09 Nov 2012 05:35 PM |
| I did try the wiki before i came here, u shouldnt be such a judger. |
|
|
| Report Abuse |
|
|