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 » Scripters
Home Search
 

Re: Kill Block

Previous Thread :: Next Thread 
xxBlockMaster66xx is not online. xxBlockMaster66xx
Joined: 28 May 2017
Total Posts: 7
07 Sep 2017 11:12 AM
I am trying to make a brick kill a player when it is touched, but it only targets the player name the is in the code, if any other person steps on it it wont work. here is the script i am using:

local workspace = script.Parent.Parent
local part = script.Parent

part.touched:connect(function ()
script.Parent.Parent.xxBlockMaster66xx.Humanoid.Health = (0)
end)

If my bro logs in with his acct it doesn't kill him.
Report Abuse
InfiniteYield is online. InfiniteYield
Joined: 01 Mar 2012
Total Posts: 762
07 Sep 2017 11:19 AM
part.Touched:connect(function(s)
if s.Parent:findFirstChild("Humanoid") then
s.Parent.Humanoid.Health = 0
end
end)


Report Abuse
systemise is not online. systemise
Joined: 04 Nov 2009
Total Posts: 349
07 Sep 2017 11:21 AM
The touched method passes whatever part triggered it as the first argument,

script.Parent.Touched:connect(function(touchedPart)
if touchedPart.Parent:FindFirstChild("Humanoid") --To make sure the part is a limb.
touchedPart.Parent.Humanoid:TakeDamage(100)
end
end)
Report Abuse
systemise is not online. systemise
Joined: 04 Nov 2009
Total Posts: 349
07 Sep 2017 11:22 AM
Touched event***
Report Abuse
InfiniteYield is online. InfiniteYield
Joined: 01 Mar 2012
Total Posts: 762
07 Sep 2017 11:23 AM
^^ you forgot "then" after that if statement. :P


Report Abuse
WXBZ is not online. WXBZ
Joined: 10 Oct 2012
Total Posts: 850
07 Sep 2017 11:28 AM
@systemise

I suggest replacing humanoid checking with player checking as then if something that isn't a player, that isn't supposed to die won't die.

if (game:GetService"Players":FindFirstChild(touchedPart.Parent.Name)) then


#code local function IsAuthorSmart(msg) if (msg:match(":connect")) then return false; else return true; end; end; if (IsAuthorSmart(thread)) then print "nice!"; end;
Report Abuse
systemise is not online. systemise
Joined: 04 Nov 2009
Total Posts: 349
07 Sep 2017 11:29 AM
Nice catch, I wasn't thinking while typing it out in the post.
Report Abuse
systemise is not online. systemise
Joined: 04 Nov 2009
Total Posts: 349
07 Sep 2017 11:30 AM
His use case didn't specify it being used exclusively to kill players, so I decided to use a less expensive method. Sue me.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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