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: Why won't this work?

Previous Thread :: Next Thread 
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
04 Dec 2012 06:11 PM
I have this script in a gun, and it still won't work:
function onDied()
for i =1,script.MoneyCount.Value do
local xp = Instance.new("Part")
xp.Parent = game.Workspace
xp.Position = script.Parent.Parent.Torso.Position + Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))
xp.Shape = 1
xp.FormFactor = "Plate"
xp.Name = "Ammo"
xp.BrickColor = BrickColor.new(21)
xp.Reflectance = 0
xp.Size = Vector3.new(1,0.4,2)
local clone = script.AmmoGiver:Clone()
clone.Disabled = false
clone.Parent = xp
end
end

script.Parent.Died:connect(onDied)
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
04 Dec 2012 06:13 PM
.Died is an event for Humanoid, not Tools or Models.
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
04 Dec 2012 06:14 PM
How do I get it into a humaniod?
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
04 Dec 2012 06:15 PM
You just attach the event to the humanoid?
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
04 Dec 2012 06:15 PM
You could insert a humanoid model into a gun or something...

There might be some coding involved to get it to work though, I'm not sure.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
04 Dec 2012 06:16 PM
If you don't know how to help, don't. ._.
Report Abuse
spynaz is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
04 Dec 2012 06:36 PM
You get the player's humanoid, the one holding the weapon (Remember, the tool goes into the player's model in workspace when it is equipped):

Tool = script.Parent
Humanoid = Tool.Parent:findFirstChild("Humanoid")
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
09 Dec 2012 12:57 PM
Where do I put this then:

Tool = script.Parent
Humanoid = Tool.Parent:findFirstChild("Humanoid")
Report Abuse
joeyisabigtacoonmars is not online. joeyisabigtacoonmars
Joined: 07 Jul 2011
Total Posts: 126
09 Dec 2012 01:01 PM
scripting confuses me but if u can do it u have skill
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
09 Dec 2012 02:58 PM
Do I need to rewrite or something?
Report Abuse
spynaz is online. spynaz
Joined: 17 Feb 2011
Total Posts: 1326
10 Dec 2012 09:26 PM
function onDied()
for i =1,script.MoneyCount.Value do
local xp = Instance.new("Part")
xp.Parent = game.Workspace
xp.Position = script.Parent.Parent.Torso.Position + Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))
xp.Shape = 1
xp.FormFactor = "Plate"
xp.Name = "Ammo"
xp.BrickColor = BrickColor.new(21)
xp.Reflectance = 0
xp.Size = Vector3.new(1,0.4,2)
local clone = script.AmmoGiver:Clone()
clone.Disabled = false
clone.Parent = xp
end
end

Tool = script.Parent
Humanoid = Tool.Parent:findFirstChild("Humanoid")

Humanoid.Died:connect(onDied)
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
11 Dec 2012 03:53 PM
BTW, I'm doing this in test mode.
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