|
| 08 Sep 2012 09:37 PM |
This isn't firing onclick --------------------------------------------------------------------------------------- function Fire()
if script.Parent.Ammo.Value >= 1 then
local NewPart = Part:Clone() --creating a new part local Ray = Ray.new(Tool.Handle.CFrame.p, (mouse.Hit.p-Tool.Handle.CFrame.p).unit*300) --creating the ray, (Ray.new(origin,direction) the .unit*300 is the distance local Hit,Position = game.Workspace:FindPartOnRay(Ray,Character) --Getting information from the ray local Distance = (Position - Tool.Handle.CFrame.p).magnitude --Getting distance from the Ray's postion and the tool NewPart.Size = Vector3.new(0.2,0.2,Distance) --Setting up the part NewPart.CFrame = CFrame.new(Position, Tool.Handle.CFrame.p) * CFrame.new(0,0,-Distance/2) NewPart.Parent = Character game.Debris:AddItem(NewPart,0.1) --Dont like spammed parts. print("m") script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
else Reload(Key) end end -----------------------------------------------------------------------------------------
Mouse.Button1Down:connect(function() Fire() |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
|
| 08 Sep 2012 09:38 PM |
It's broken.....so uh
go ahead and take it |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
|
| 08 Sep 2012 09:39 PM |
| Anyone have an idea why it isnt firing? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 08 Sep 2012 09:42 PM |
| Are there any errors in the output? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 09:42 PM |
None, and the two otehr functions I have are working fine.
Also, all the variables used are defined. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 09:44 PM |
All these are defined in the beggining of the script:
local Character = game.Players.LocalPlayer.Character local Tool = script.Parent local Part = Instance.new("Part") Part.Transparency = .5 Part.BrickColor = BrickColor.new("Lime green") Part.Anchored = true Part.CanCollide = false Part.FormFactor = "Custom"
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 08 Sep 2012 10:40 PM |
MouseButton1Click:connect
? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 10:56 PM |
| Or Maybe even ClickDetector.MouseClick:connect if it's a click detector |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 10:57 PM |
Did you add a parent to the Part?
All I see is local Part = Instance.new("Part")
Try
local Part = Instance.new("Part", Workspace) |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 08:24 AM |
@Poops
The raycast script works fine.
It just isnt firing
I tried switching all Mouses to mouse still isnt working
09:22:47 - Players.Player262.Backpack.TurretTool.RayCaster:47: attempt to index local 'mouse' (a nil value) 09:22:47 - Script "Players.Player262.Backpack.TurretTool.RayCaster", Line 47 - global Fire 09:22:47 - Script "Players.Player262.Backpack.TurretTool.RayCaster", Line 71 09:22:47 - stack end 09:22:47 - Disconnected event because of exception |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 09 Sep 2012 08:31 AM |
This seemed like an obvious error.
You need to connect a function for when you equip the tool, then define mouse.
function Load(cheeselover) mouse = cheeselover end
script.Parent.Equipped:connect(Load) --Not sure about the event's name.
You need to make sure that mouse exists, I don't really know a more simple way to do this, but the above function usually works well for me.
Let us know if it works out.
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 09:47 AM |
| Obvious error. Look at the bottom, you forgot a ). |
|
|
| Report Abuse |
|
|