23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 20 Mar 2014 08:37 PM |
so I have this lazer turret script that shoots zombies the problem is that if more then one zombie is in the radios of it, it will shoot them both at the same time(make 2 lazers and shoot both) and I want to know how to make it stop doing that
here is the script
repeat wait() until script.Parent.Parent.Parent.Parent.Name~="Products" RadX = 30 --Width of the radios. RadY = 65 --Height of the radios. RadZ = 30 --Depth of the radios. --Or you could do "RadSize = Vector3.new(X#,Y#,Z#)" Radios = Instance.new("Part",script.Parent.Parent.Parent.Parent) --Making the radios part, if you want it in a model, then change "Workspace" to script.Parent or wherever the model is. Radios.Anchored = true --No physics. Radios.Size = Vector3.new(RadX,RadY,RadZ) --Making it as it as defined. Radios.CFrame = CFrame.new(script.Parent.Position) --Assuming you want the radious's center to be the part that it'll e firing from? Radios.Name = "Radios3" --I like names. --If you chose the Vector3.new option it'd be Radios.Size = RadSize. Radios.Transparency = 1 --No need to see the radios of the lazer. Radios.CanCollide = false --A non-solid part. function onTouched(Hit) --Touched event. if Hit.Parent.Name == "Zombie" and Hit.Name == "Torso" then--Or whatever your Zombie's name is. print "Is Zombie" --We found a Zomie to murder. repeat ray = Ray.new( --A new ray for raycasting lazer. script.Parent.Position, --Ray origen. Hit.Position --Ray end. ) distance = (Radios.Position - Hit.Position).magnitude --Calculting the ray distance. rayPart = Instance.new("Part", Workspace) --Creatig a new part for the ray. rayPart.Name = "RayPart" --I still like names. rayPart.BrickColor = BrickColor.new("Bright red") --Color the brick? =3 rayPart.Transparency = 0.5 --Giving it transparency. rayPart.Anchored = true --You don't want the ray to fall. rayPart.CanCollide = false --You can't collide with it. rayPart.TopSurface = Enum.SurfaceType.Smooth --Smooth top rayPart.BottomSurface = Enum.SurfaceType.Smooth --Smooth bottom. rayPart.formFactor = Enum.FormFactor.Custom --Custom formfactor, can be sized to any size. rayPart.Size = Vector3.new(0.2, 0.2, distance)--Sizing the brick. start = script.Parent rayPart.CFrame = CFrame.new(start.Position, Hit.Position) * CFrame.new(0, 0, -distance/2) --Positioning the brick. game.Debris:AddItem(rayPart, 0.25)--Change 0.25 to however long you want the ray to stay there. Hit.Parent.Zombie.Health = (Hit.Parent.Zombie.Health - 3) --Taking health away. Change 100 to any value you'd like. wait(0.3) --Change this to the time it takes for the next attack until Hit.Parent.Zombie.Health == 0 else print "Not Zombie" --Telling us that the toucher isn't a Zombie. print("The item that touched is "..Hit.Name) --Who touched the part? end end script.Parent.Parent.Parent.Parent.Radios3.Touched:connect(onTouched) --If This is in a model then make it something like Script.Parent.(Directory to the Radios part) |
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 20 Mar 2014 08:46 PM |
| make your own scripts no free models k |
|
|
| Report Abuse |
|
|
23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 20 Mar 2014 09:15 PM |
I would say k if it was a free model but its not |
|
|
| Report Abuse |
|
|
23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 21 Mar 2014 09:31 PM |
come on guys I know some of you got to know how
and don't say use debounce I already tried |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 09:35 PM |
so why are there comments on it?
better question, what are comments? |
|
|
| Report Abuse |
|
|
23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 21 Mar 2014 11:15 PM |
| the comments are so I remember what that line does |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:20 PM |
Just add db.
Such as: db = false
if db == true then return end db = true Spawn(function() wait(5) db = false end)--5 second between shots
4 lines of code to fix it. |
|
|
| Report Abuse |
|
|
23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 15 Apr 2014 11:36 PM |
| I have already tried debounce |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 15 Apr 2014 11:39 PM |
srry but lol
Radios = Instance.new("Part",script.Parent.Parent.Parent.Parent) --Making the radios part, if you want it in a model, then change "Workspace" to script.Parent or wherever the model is.
This line. No scripter would ever need this line. |
|
|
| Report Abuse |
|
|
23134
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 35 |
|
|
| 15 Apr 2014 11:54 PM |
ITS NOT A F@@@EN MODEL IF IT IS GO FIND IT AND SHOW IT 2 ME
|
|
|
| Report Abuse |
|
|