|
| 14 Dec 2013 07:24 PM |
Fire script in my plane is broken. Output does not help. It does not tell me anything. Any help would be appreciated!
function findPlane(find) local list = player.Character:GetChildren() for x = 1, #list do if (list[x].Name == "Plane") then return list[x] end end return nil end
function fire(key) local plane = findPlane(script.Parent.Parent.Parent) local Gun = plane.MainParts.Gun1 local Spawnpos = Gun.CFrame.lookVector * 4 local bullet = Instance.new("Part") debounce = false bullet.Parent = workspace bullet.Name = "Missile" bullet.Size = Vector3.new(1, 1, 1) bullet.Shape = "Ball" bullet.BrickColor = BrickColor.new("Bright red") bullet.Position = Spawnpos bullet.Velocity = Gun.CFrame.lookVector * 200 bullet.Touched:connect(function(hit) local e = Instance.new("Explosion") e.Parent = workspace e.Position = bullet.Position game:GetService("Debris"):AddItem(bullet, 20) e.BlastRadius = 20 e.BlastPressure = 1000 end) wait(3) debounce = true end
function onKeyDown(key) if (key~=nil) then key = key.lower() local plane = findPlane(script.Parent.Parent) if (plane==nil) then return end m = plane.MainParts local engine = plane.MainParts.Main if (key=="f") then fire(plane,m.Gun1) wait (.25) end end end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
Madified
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 5292 |
|
| |
|
|
| 14 Dec 2013 08:50 PM |
| Output says nothing. At all. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 09:02 PM |
| Why don't that many people help? |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 09:09 PM |
| I don't know if this really matters, but the script is not local. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Dec 2013 09:19 PM |
| Patrickbowen, It takes more than ten minutes to help! Hold your horses! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 14 Dec 2013 10:40 PM |
| Did you forget to post your connection lines, or are they non-exitant? |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 10:48 PM |
What am I missing?
function findPlane(player) local list = player.Character:GetChildren() for x = 1, #list do if (list[x].Name == "Plane") then return list[x] end end return nil end
function fire(mouse, key) local plane = findPlane(script.Parent.Parent.Parent) local Gun = plane.MainParts.Gun1 local Spawnpos = Gun.CFrame.lookVector * 4 debounce = false local bullet = Instance.new("Part") bullet.Parent = workspace bullet.Name = "Missile" bullet.Size = Vector3.new(1, 1, 1) bullet.Shape = "Ball" bullet.BrickColor = BrickColor.new("Bright red") bullet.Position = Spawnpos bullet.Velocity = Gun.CFrame.lookVector * 200 bullet.Touched:connect(function(hit) local e = Instance.new("Explosion") e.Parent = workspace e.Position = bullet.Position game:GetService("Debris"):AddItem(bullet, 20) e.BlastRadius = 20 e.BlastPressure = 1000 end) wait(3) debounce = true end
function onKeyDown(key) if (key~=nil) then key = key.lower() local plane = findPlane(script.Parent.Parent) if (plane==nil) then return end m = plane.MainParts local engine = plane.MainParts.Main if (key=="f") then fire(plane,m.Gun1) wait (.25) end end end
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(fire) end)
|
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 10:51 PM |
| Sorry. I havn't scripted one of these planes in atleast... 2 years. Seems like the old scripts don't work anymore... So i'm kind of lost on what to do. |
|
|
| Report Abuse |
|
|
| |
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 15 Dec 2013 11:07 AM |
Add prints to see where it stops.
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2013 11:29 AM |
print ("All systems green!") wait (.25) print ("Hope this works.")
local player = script.Parent.Parent.Parent debounce = true
function findPlane(player) local list = player.Character:GetChildren() for x = 1, #list do if (list[x].Name == "Plane") then print ("Found Plane!") return list[x] else print ("No Plane!") end end return nil end
function fire(mouse, key) local plane = findPlane(script.Parent.Parent.Parent) local Gun = plane.MainParts.Gun1 local Spawnpos = Gun.CFrame.lookVector * 4 debounce = false local bullet = Instance.new("Part") bullet.Parent = workspace bullet.Name = "Missile" bullet.Size = Vector3.new(1, 1, 1) bullet.Shape = "Ball" bullet.BrickColor = BrickColor.new("Bright red") bullet.Position = Spawnpos bullet.Velocity = Gun.CFrame.lookVector * 200 bullet.Touched:connect(function(hit) local e = Instance.new("Explosion") e.Parent = workspace e.Position = bullet.Position game:GetService("Debris"):AddItem(bullet, 20) e.BlastRadius = 20 e.BlastPressure = 1000 end) wait(3) debounce = true end
function onKeyDown(key) if (key~=nil) then key = key.lower() local plane = findPlane(script.Parent.Parent) if (plane==nil) then return end m = plane.MainParts local engine = plane.MainParts.Main if (key=="f") then if not debounce then print ("debounce!") else print ("Fire mechanism completed!") fire(plane,m.Gun1) wait (.25) end end end end
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(fire) end)
Two triggers worked... Uhhhh. "No plane!" and "Found Plane!" That's at "function findPlane". |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2013 11:37 AM |
Scratch the last reply. I moved the prints around... I accidentally put them in the wrong spots. Only print that triggers is "No plane!" and then the output tells me that "MainParts" is not a member of "plane" on line 26 in the fire function. I'm led to believe that the main problem is in the "findPlane" function. Here's my script:
print ("All systems green!") wait (.25) print ("Hope this works.")
local player = script.Parent.Parent.Parent debounce = true
function findPlane(player) local list = player.Character:GetChildren() for x = 1, #list do if (list[x].Name == "Plane") then print ("Found Plane!") else print ("no plane!") return list[x] end end return nil end
function fire(mouse, key) local plane = findPlane(script.Parent.Parent.Parent) local Gun = plane.MainParts.Gun1 local Spawnpos = Gun.CFrame.lookVector * 4 debounce = false local bullet = Instance.new("Part") bullet.Parent = workspace bullet.Name = "Missile" bullet.Size = Vector3.new(1, 1, 1) bullet.Shape = "Ball" bullet.BrickColor = BrickColor.new("Bright red") bullet.Position = Spawnpos bullet.Velocity = Gun.CFrame.lookVector * 200 bullet.Touched:connect(function(hit) local e = Instance.new("Explosion") e.Parent = workspace e.Position = bullet.Position game:GetService("Debris"):AddItem(bullet, 20) e.BlastRadius = 20 e.BlastPressure = 1000 end) wait(3) debounce = true end
function onKeyDown(key) if (key~=nil) then key = key.lower() local plane = findPlane(script.Parent.Parent) if (plane==nil) then return end m = plane.MainParts local engine = plane.MainParts.Main if (key=="f") then if not debounce then print ("debounce!") else print ("Fire mechanism completed!") fire(plane,m.Gun1) wait (.25) end end end end
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(fire) end)
|
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 15 Dec 2013 11:40 AM |
Try adding every 5 lines. Add those prints every 5 lines
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2013 11:46 AM |
| Why do I need another print if i found the problem in findPlane? Sorry for my idiocracy. I have not worked with planes for a while. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Madified
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 5292 |
|
| |
|
|
| 15 Dec 2013 12:45 PM |
| If you won't help fix this script, don't bother to reply to this post at all. I don't script stuff like this, so I don't know what I'm doing. I need help. |
|
|
| Report Abuse |
|
|
| |
|