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: Making weapons give kills.

Previous Thread :: Next Thread 
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
18 May 2013 07:09 PM
I'm trying to learn how to make a gun give KOs, any pointers or tips?

Report Abuse
vampirexevipex is not online. vampirexevipex
Joined: 11 Apr 2009
Total Posts: 1598
18 May 2013 07:16 PM
Yus, make the tool give the bullet a ObjectValue and a script, make the ObjectValue's Value be the Player who activated the tool, and the script should have the Touched event (a part that says function onHit(whatever) ) in one of its lines, that kills the player who got hit by the bullet and at the same time give the killer +1 KO by checking the Object Value.

^Tell me how hard is that to understand
Report Abuse
vampirexevipex is not online. vampirexevipex
Joined: 11 Apr 2009
Total Posts: 1598
18 May 2013 07:17 PM
Woops made an error:

...the script should have the Touched event (a part that says function onHit(whatever) ) in one of its lines, make the function kill the player who got hit by the bullet and at the same time give the killer +1 KO by checking the Object Value.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
18 May 2013 07:19 PM
How does it know when the target dies?
Report Abuse
vampirexevipex is not online. vampirexevipex
Joined: 11 Apr 2009
Total Posts: 1598
18 May 2013 07:24 PM
you can make it instantly kill the player or check if it died by using this lines after the lines which made the player take damage:

if hit.Humanoid.Health < 1 then --just incase the health changes to a negative number
--DoStuffHere
end
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
18 May 2013 07:26 PM
I'm looking at the LinkedSlingshot and i'm guessing this is the code?




function onTouched(hit)
humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid~=nil then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
else
damage = damage / 2
if damage < 1 then
connection:disconnect()
pellet.Parent = nil
end
end
end

function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = pellet:findFirstChild("creator")
if tag ~= nil then
-- kill all other tags
while(humanoid:findFirstChild("creator") ~= nil) do
humanoid:findFirstChild("creator").Parent = nil
end

local new_tag = tag:clone()
new_tag.Parent = humanoid
debris:AddItem(new_tag, 1)
end
end
Report Abuse
btft is not online. btft
Joined: 19 Feb 2011
Total Posts: 1512
18 May 2013 07:29 PM
@Brayden, Humanoid.Died:connect(function()
end)
Report Abuse
vampirexevipex is not online. vampirexevipex
Joined: 11 Apr 2009
Total Posts: 1598
18 May 2013 07:31 PM
Well... thats the code for the pellets the slingshot shoots, you can use it if you want... btw. I never understand why roblox uses sooooo many functions
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
18 May 2013 07:47 PM
@btft, I should check humanoid:Died:connect(function() instead of humanoid.Health < 0?
Report Abuse
btft is not online. btft
Joined: 19 Feb 2011
Total Posts: 1512
18 May 2013 07:51 PM
No. Because you are checking each time the bullet hits. I was just making a point.
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