generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 08:20 PM
bump
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 08:41 PM
bump
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
14 Dec 2013 08:43 PM
[ Content Deleted ]
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 08:50 PM
Output says nothing. At all.
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 09:02 PM
Why don't that many people help?
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 09:09 PM
I don't know if this really matters, but the script is not local.
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 09:17 PM
bump
Report Abuse
CyberViper is not online. CyberViper
Joined: 14 Feb 2010
Total Posts: 239
14 Dec 2013 09:19 PM
Patrickbowen, It takes more than ten minutes to help! Hold your horses!
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 09:43 PM
Okay. Sorry.
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
14 Dec 2013 10:39 PM
bump
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Dec 2013 10:40 PM
Did you forget to post your connection lines, or are they non-exitant?
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
15 Dec 2013 10:55 AM
bump
Report Abuse
mic144 is not online. 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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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 is not online. 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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
15 Dec 2013 12:05 PM
bump
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
15 Dec 2013 12:16 PM
bump1
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
15 Dec 2013 12:28 PM
[ Content Deleted ]
Report Abuse
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
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
patrickbowen is not online. patrickbowen
Joined: 30 Jan 2009
Total Posts: 194
15 Dec 2013 07:35 PM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image