KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 27 Nov 2013 06:20 PM |
If someone could make me a simple "gun" with an ivisible ray that hurts something, I would be grateful, but I would be more grateful if u fixed my broken one.
http://pastebin.com/fNpra4RG |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Nov 2013 06:21 PM |
| There is a tutorial in the wiki. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
| |
|
squerpooo
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 2356 |
|
|
| 27 Nov 2013 06:50 PM |
| If you've read it just build a gun and use the same code. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 27 Nov 2013 06:52 PM |
Their code is broken, I tried bro. SO please just fix my other one |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Nov 2013 06:55 PM |
| Its not broken I've used it before. |
|
|
| Report Abuse |
|
|
squerpooo
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 2356 |
|
|
| 27 Nov 2013 06:57 PM |
| ROBLOX wiki does not make mistakes. People do. I tried it, and it worked before. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 27 Nov 2013 07:03 PM |
Well, I guess my tool needed to be named something, but still........ if u cannot fix then plaese gimme the wiki version |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2013 07:10 PM |
| Why does yours have a bunch of comments spammed all over it?? If we're trying to help Im pretty sure we would know what that stuff means. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 27 Nov 2013 08:43 PM |
I get that a lot, and it's for me. Anyways, can i has that wiki script |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 27 Nov 2013 08:47 PM |
This is the wiki code:
local tool = script.Parent local user --when the tool is equipped tool.Equipped:connect(function(mouse) --store the character of the person using the tool user = tool.Parent --when the left mouse button is clicked mouse.Button1Down:connect(function() --make and do a hit test along the ray local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) --do damage to any humanoids hit local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(30) end --draw the ray local distance = (position - tool.Handle.CFrame.p).magnitude local 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) --add it to debris so it disappears after 0.1 seconds game.Debris:AddItem(rayPart, 0.1) end) end)
This is what you want:
local tool = script.Parent local user --when the tool is equipped tool.Equipped:connect(function(mouse) --store the character of the person using the tool user = tool.Parent --when the left mouse button is clicked mouse.Button1Down:connect(function() --make and do a hit test along the ray local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) --do damage to any humanoids hit local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(30) end end) end) |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 28 Nov 2013 12:13 AM |
I've never used a tag like that:
local user -- then what
and
hit, position -- are they the same thing? |
|
|
| Report Abuse |
|
|
squerpooo
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 2356 |
|
|
| 02 Dec 2013 11:27 AM |
| Just run the code, the script takes care of it. You need nothing to change. |
|
|
| Report Abuse |
|
|
|
| 02 Dec 2013 11:29 AM |
Kevek, you're basically asking for an entire game every time you come here >_>
The wiki has everything you need to know about scripting. Go learn then bring YOUR OWN code if it doesn't work.
"Ladies and gentlemen, take my advice. Pull down your pants and slide on the ice" |
|
|
| Report Abuse |
|
|
einsteinK
|
  |
| Joined: 22 May 2011 |
| Total Posts: 1015 |
|
|
| 02 Dec 2013 11:29 AM |
Ray.new (wep.Handle.CFrame.p (mouse.Hit.p) - wep.Handle.Cframe.p).unit * 100
Should actually be in your code:
local pos = wep.Handle.Position Ray.new(pos,CFrame.new(pos,mouse.Hit.p).lookVector*999) |
|
|
| Report Abuse |
|
|