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
 

Re: Laser Script Help

Previous Thread :: Next Thread 
leperdy is not online. leperdy
Joined: 07 Dec 2008
Total Posts: 1406
27 Sep 2012 10:49 AM
Hi, I am working on a laser turret that shoots a ball with a body position that makes it go to an invisible brick at the end of the beam. The output says "2" but nothing else, and for some reason it wont put a touch interest in beam.




local base = script.Parent.base
local shooter = script.Parent.shooter
local Sights = script.Parent.Sights
local beam = script.Parent.beam

local locate = script.Parent.Locate
print(2)
function onTouched()
print(3)

Sights.Reflectance = 1
wait(0.5)
Sights.Reflectance = 0

blast = Instance.new("Part")
blast.Shape = ("Ball")
blast.CFrame = CFrame.new(Sights.Position-Vector3.new(1, 0, 0))
blast.Size = (Vector3.new(1, 1.2, 1))
fly = Instance.new("BodyPosition")
fly.Position = Locate.Position
blast.Parent = script.Parent
print(1)
wait(1)


end

connection = beam.Touched:connect(onTouched)
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
27 Sep 2012 11:55 AM
local base = script.Parent.base
local shooter = script.Parent.shooter
local Sights = script.Parent.Sights
local beam = script.Parent.beam

local locate = script.Parent.Locate
print(2)
function onTouched()
print(3)

Sights.Reflectance = 1
wait(0.5)
Sights.Reflectance = 0

blast = Instance.new("Part")
blast.Shape = ("Ball")
blast.CFrame = CFrame.new(Sights.Position-Vector3.new(1, 0, 0))
blast.Size = (Vector3.new(1, 1.2, 1))
fly = Instance.new("BodyPosition")
fly.Position = Locate.Position
blast.Parent = script.Parent
print(1)
wait(1)


end

script.Parent.Touched:connect(onTouched)
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
27 Sep 2012 11:56 AM
That last line of his was fine. Did you change anything else there?
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
27 Sep 2012 11:57 AM
No, it just looked funny to me. I'm too old fashioned. :S
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
27 Sep 2012 12:00 PM
:>

Tbf, I can't find anything wrong with it either, other than the BodyPosition he created has no parent q-q
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
27 Sep 2012 12:01 PM
Looking over it again, shouldn't blast's parent be defined before you give it all of it's properties?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
27 Sep 2012 12:04 PM
I was thinking that too, but I know that instances with a nil parent can be brought to workspace or wherever at any time...i think.

The only thing i can see is that these lines

fly = Instance.new("BodyPosition")
fly.Position = Locate.Position

should be

fly = Instance.new("BodyPosition", blast)
fly.position = Locate.Position

That said, maybe Roblox isn't case-sensitive on properties
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
27 Sep 2012 12:09 PM
Oh. I thought defining the Parent was always the main priority...
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
27 Sep 2012 12:14 PM
I guess we'll find out when the OP comes back online C:
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