|
| 28 Jan 2012 02:38 PM |
I am trying to make a hit marker script where a bullet hits somebody, it clones a GUI from lighting. But for some reason this script won't work. Please fix!
gui = "HitMarker" function onTouched(hit) if hit:findFirstChild("Humanoid") ~= nil then cl = game.Lighting.gui cl1 = cl:clone() ply = hit:getPlayerFromCharacter() cl1.Parent = ply.StarterGui end end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 02:40 PM |
The reason because your wanting to clone it in startergui. So when they die they will see it. You need to clone it into a player's playergui. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 02:41 PM |
OMG! Thanks so it would be like:
gui = "HitMarker" function onTouched(hit) if hit:findFirstChild("Humanoid") ~= nil then cl = game.Lighting.gui cl1 = cl:clone() ply = hit:getPlayerFromCharacter() cl1.Parent = ply.PlayerGui ------Here end end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 28 Jan 2012 02:42 PM |
gui = "HitMarker" function onTouched(hit) if hit:findFirstChild("Humanoid") ~= nil then cl = game.Lighting.gui cl1 = cl:clone() ply = hit:getPlayerFromCharacter() cl1.Parent = ply.PlayerGui end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jan 2012 02:48 PM |
Ok another probllem is I don't know where to put the script...So I tried to do this:
function onHit() part="Bullet" part.findfirstChild gui = "HitMarker" function onTouched(hit) if hit:findFirstChild("Humanoid") ~= nil then cl = game.Lighting.gui cl1 = cl:clone() ply = hit:getPlayerFromCharacter() cl1.Parent = ply.StarterGui end end
script.Parent.Touched:connect(onTouched)
Now I know this is really wrong so can someone fix this? |
|
|
| Report Abuse |
|
|
rcm
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 621 |
|
|
| 28 Jan 2012 03:04 PM |
gui = "HitMarker" function onTouched(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then ply = hit.Parent:getPlayerFromCharacter() if ply ~= nil and ply.PlayerGui:findFirstChild(gui) == nil then cl = game.Lighting.gui cl1 = cl:clone() cl1.Parent = ply.PlayerGui end end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
cart6157
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 2194 |
|
|
| 28 Jan 2012 03:05 PM |
At getPlayerFromCharacter something is wrong, tells me a feeling, even though I never use it. I do this:
Ply = game.Players:findFirstChild(hit.Parent.Name)
Try this out. |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jan 2012 03:27 PM |
| But where would I put the script? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 03:28 PM |
| Follow Me To The Awesomest Place In ROBLOX!!! |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 03:35 PM |
| Should I put the script inside the Bullet script or inside the Gun? |
|
|
| Report Abuse |
|
|
rcm
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 621 |
|
|
| 28 Jan 2012 03:35 PM |
You would put the script in your "bullet" part.
If your using it for a gun, then insert a new script inside the main gun script and name it "BulletScript". Paste the fixed code inside the BulletScript and set the .Disabled property to true. Then add the following code in the gun script after it creates a bullet:
bulletscript = script.BulletScript:clone() bulletscript.Parent = BULLET --change to the name of the bullet variable bulletscript.Disabled = false |
|
|
| Report Abuse |
|
|
rcm
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 621 |
|
|
| 28 Jan 2012 03:36 PM |
| Latechat, just put it in your bullet script. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jan 2012 08:36 AM |
I need a test subject and here is where I put the script:
-Tool --Bullet Script ---HitMarker script~ is that right? --Shooter script --Aim Down Sights --Gun Parts |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 29 Jan 2012 02:26 PM |
| I just need a test subject |
|
|
| Report Abuse |
|
|