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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|