|
| 28 Oct 2013 07:20 AM |
function fire(d) s=script.Parent.Handle.Fire s:play() bullet=Instance.new("Part") bullet.FormFactor="Custom" bullet.Size=Vector3.new(0.4,0.2,0.2) bullet.BrickColor=BrickColor.new("Really black") bullet.Position=tool.Part.Position+(d*5) bullet.Velocity=d*100 script.Parent.GripUp=Vector3.new(0.01,1,-0.3) script.Parent.Part.Transparency=0.7 wait(.1) script.Parent.Part.Transparency=1 script.Parent.GripUp=Vector3.new(0.01,1,0) bullet.Touched:connect(function(hit) bullet:remove() chr=hit.Parent if game.Players:GetPlayerFromCharacter(chr) and chr:findFirstChild("Humanoid") then plr=game.Players:GetPlayerFromCharacter(chr) if chr.Humanoid.Health>0 then chr.Humanoid:TakeDamage(math.random(10,20)) end v=Workspace.g:GetChildren() -- this is where it goes wrong @@@@@@@@@ else if v:hit() then game.Workspace.v.Transparency=1 game.Workspace.v.CanCollide=false wait(1000) game.Workspace.v.Transparency=0.5 game.Workspace.v.CanCollide=true end end end) force=Instance.new("BodyForce") force.force=Vector3.new(0,3,0) force.Parent=bullet bullet.Parent=game.Workspace end
Help me with the script, v=workspace.g:GetChildren() should get the children out of g which are g1 and g2 but if they are hit by the bullet one of them which got hit should disapear . |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 28 Oct 2013 11:40 AM |
| Line 3: You cannot play a fire. Didn't read it all though. |
|
|
| Report Abuse |
|
|
UgOsMiLy
|
  |
| Joined: 15 Sep 2009 |
| Total Posts: 2095 |
|
|
| 28 Oct 2013 11:42 AM |
| Line 3: Its Fire.Enabled = true |
|
|
| Report Abuse |
|
|
UgOsMiLy
|
  |
| Joined: 15 Sep 2009 |
| Total Posts: 2095 |
|
|
| 28 Oct 2013 11:44 AM |
| I think you forgot to tell the script what you mean by "G" but if you have something in the workspace actually called g then ignore me. |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 11:45 AM |
| Yeah i fixed that but the problem i with g1 touching with the bullet making it disapear which does not work |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 11:46 AM |
v=Workspace.g:GetChildren() game.Workspace.v.Transparency=1 game.Workspace.v.CanCollide=false wait(1000) game.Workspace.v.Transparency=0.5 game.Workspace.v.CanCollide=true |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 11:47 AM |
| "g" is a group inside it there is g1 , g2. |
|
|
| Report Abuse |
|
|
UgOsMiLy
|
  |
| Joined: 15 Sep 2009 |
| Total Posts: 2095 |
|
|
| 28 Oct 2013 11:55 AM |
| Sorry, but i am not an expert scripter, I can only do stuff like local and while true do and if and function. |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 11:57 AM |
| Custard ow the Fire thing is a sound when the guns fires ^^ |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Oct 2013 12:11 PM |
(Fire is a sound guys, you were correct to use :Play)
Your issue is that 'v' only means one child of "g". Try reading through "generic for" on the Wiki. This is an example of one:
for _,v in pairs(g:GetChildren()) do --This gets ALL the children of "g". The variable for all of these is "v". v.Transparency=1 --Will set "v" (all children of "g") to 1 transparency. end |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 12:15 PM |
| Yes i know that but my problem is when child of g is touched by bullet it should disapear so i take all of the children out of g and the one which gets touched by bullet should disapear but it doesnt and i dont know how to fix that ;/ |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 12:17 PM |
v=g:GetChildren()
The term v is only applicable to ONE child of g.
You would either to do it manually (v[1],v[2],etc) or do what I said. There is another method but is haxxy and uses too much CPU by checking every child. |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2013 12:22 PM |
| Ok it works but it makes all of the g's disapear and it should make the glass which got touched by a bullet. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|