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: Getting a GUI from Lighting

Previous Thread :: Next Thread 
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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
MisterScripter is not online. MisterScripter
Joined: 24 Sep 2010
Total Posts: 702
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
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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 is not online. 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
MisterScripter is not online. MisterScripter
Joined: 24 Sep 2010
Total Posts: 702
28 Jan 2012 02:42 PM
Yes.
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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 is not online. 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 is not online. 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
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
28 Jan 2012 03:12 PM
OK
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
28 Jan 2012 03:27 PM
But where would I put the script?
Report Abuse
hoboassassin489 is not online. hoboassassin489
Joined: 13 Aug 2010
Total Posts: 63
28 Jan 2012 03:28 PM
Follow Me To The Awesomest Place In ROBLOX!!!
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
28 Jan 2012 03:35 PM
Should I put the script inside the Bullet script or inside the Gun?
Report Abuse
rcm is not online. 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 is not online. rcm
Joined: 29 Jul 2008
Total Posts: 621
28 Jan 2012 03:36 PM
Latechat, just put it in your bullet script.
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
28 Jan 2012 03:37 PM
Thanks!
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
29 Jan 2012 09:55 AM
Halp
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
29 Jan 2012 09:57 AM
[ Content Deleted ]
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
29 Jan 2012 11:34 AM
Thanks
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
29 Jan 2012 02:26 PM
I just need a test subject
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