|
| 01 Nov 2014 08:09 PM |
I just finished reading the raycasting wiki and now I want to know how to make it emit from a part instead of your torso. Help me?
Here is the script:
--settings range = 999 --ray range damage = 18 --ray damage color = 'Bright yellow' raytrans = 0 --ray color --do not edit below!!
local tool = script.Parent local char tool.Equipped:connect(function(mouse) char = tool.Parent mouse.Button1Down:connect(function() --Making things local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*range) local hit, position = game.Workspace:FindPartOnRay(ray, char) --Time to do damage local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(damage) end --Now making teh ray/bullet local distance = (position - tool.Handle.CFrame.p).magnitude local rayp = Instance.new('Part', char) rayp.Name = 'rayp' rayp.BrickColor = BrickColor.new(color) rayp.Transparency = raytrans rayp.Anchored = true rayp.CanCollide = false rayp.TopSurface = Enum.SurfaceType.Smooth rayp.BottomSurface = Enum.SurfaceType.Smooth rayp.formFactor = Enum.FormFactor.Custom rayp.Size = Vector3.new(0.2, 0.2, distance) rayp.CFrame = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2) ---now to add to debris so it doesnt stay there! game.Debris:AddItem(rayp, 0.1) end) end)
|
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 01 Nov 2014 08:14 PM |
| Just replace 'tool.Handle.CFrame.p' with whatever position you'd like it to shoot from. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2014 08:18 PM |
So I have a part but there is two problems:
1)It shoots from where the part was placed, I think i need to weld it.. 2)It only shoots once then stops |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Nov 2014 08:35 PM |
@God
I'm not stupid, this is already a local script. |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2014 08:38 PM |
| SHUT THE FUCK UP!!! |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 01 Nov 2014 08:47 PM |
The troll account is real. Hey, I wonder if they'll give you an IP ban? |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2014 08:49 PM |
They already tried IP banning me. XD
http://gyazo.com/26e61274b7541e27a8d5a31f2f888065 |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|