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: Kill non-morphs

Previous Thread :: Next Thread 
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 07:18 PM
Is there a script that you can put in a brick that kills non-morphed players? If so, could someone please post it for me? :)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Feb 2014 07:25 PM
for i,v in pairs(game.Players:GetChildren()) do
if v.Character.Torso.Shape == 0 then
v.Character:BreakJoints()
end end
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 07:32 PM
no

You would need something like

for i,v in pairs(char:GetChildren()) do
if v:IsA("CharacterMesh") then
return
end
end
char.Humanoid.Health = char.Humanoid.Health - .1*char.Humanoid.Health
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 07:37 PM
do you think that script will work?
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 07:41 PM
script.Parent.Touched:connect(function(part)

char = part.Parent
if char:findFirstChid("Humanoid") == nil then return end

for i,v in pairs(char:GetChildren()) do
if v:IsA("CharacterMesh") then
return
end
end

char.Humanoid.Health = 0

end)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Feb 2014 07:42 PM
for i,v in pairs(game.Players:GetChildren()) do
for x,y in pairs(v.Character:GetChildren()) do
for a,b in pairs(y:GetChildren()) do
if b:IsA("CharacterMesh") then
v.Character:BreakJoints()
end end end end

Lol pretty sure theres a more efficient way to do this.. but a CharacterMesh is stored in a Player's Character's BodyParts if I'm not mistaken.. and this searches through that.. again.. bet theres a more efficient way lmao
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 07:49 PM
Character Meshes are stored in the character.

And I'm pretty sure he said he wanted to kill NON morphed characters.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Feb 2014 07:57 PM
Gosh i'm having a bad day..
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 07:59 PM
Eh, trust me, you're not the first.

And at least you're making an effort to help others. That's commendable mate.
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 07:59 PM
That is correct theroad. Thanks, I will let you know if it works.
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 08:08 PM
@theroad

It did not kill the player when the player touched the brick. :O
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 08:12 PM
Probably because you have a morph?
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 08:19 PM
No, I wasn't morphed when I stepped on it. I was a normal humanoid.
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
21 Feb 2014 08:23 PM
FACEDESK

if char:findFirstChid("Humanoid") == nil then return end

should be

if char:findFirstChild("Humanoid") == nil then return end
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
21 Feb 2014 08:40 PM
That fixed the problem; however it does not just kill the normal player but it also kills the morphed player still :O
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
22 Feb 2014 04:57 PM
Still need help please. B1
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
22 Feb 2014 05:45 PM
B2
Report Abuse
7y13rb is not online. 7y13rb
Joined: 28 May 2011
Total Posts: 223
22 Feb 2014 05:54 PM
just make a bool value in the character, and once they morph turn it to true, like this in workspace:
function onPlayerEntered(newPlayer)

local bool = Instance.new("BoolValue", newPlayer) --i think this is right...may need to change

bool.Name = "Morphed"

end

game.Players.PlayerAdded:connect(onPlayerEntered)

then in the morph add this somewhere in it:
WHATEVERPLAYERISINSCRIPT.Morphed = true

then in the kill brick:
function onTouched(hit)
if hit.Parent.Humanoid ~= nil then --if its a human
local player = hit.Parent:GetPlayerFromCharacter --is this right?
if player.Morphed == false then
hit.Parent.Humanoid.Health = 0

end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
7y13rb is not online. 7y13rb
Joined: 28 May 2011
Total Posts: 223
22 Feb 2014 05:56 PM
--oops i think the:
local player = hit.Parent:GetPlayerFromCharacter --is this right?

--is supposed to be:
local player = hit.Parent:GetPlayerFromCharacter() --is this right?
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
23 Feb 2014 01:23 AM
And this is meant to kill the non-morphed players?
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
23 Feb 2014 01:33 AM
NVM, I see it is. Could you please repost that with all the correct line? Just so I am not confusing myself aha :) Thanks!
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
23 Feb 2014 01:56 AM
@theroad

if not char:findFirstChild("Humanoid") then

is the same thing, but in a better syntax, for future reference.
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
04 Mar 2014 11:34 PM
Is there perhaps a better script for this?
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
04 Mar 2014 11:50 PM
local Meshes = {}
local Human
local numOfMeshes = 5 --2 arms, 2 legs, 1 torso

function checkForMesh(H)
if #Meshes < numOfMeshes then
H:TakeDamage(H.Health)
end
end


for i,v in pairs(game.Players:GetChildren()) do
Meshes = {}
if v.Character then
for i,b in pairs(v.Character:GetChildren()) do
if b:IsA("CharacterMesh") then
table.insert(Meshes, v.Name)
Human = v.Character:FindFirstChild("Humanoid")
end
end
checkForMesh(Human)
end
end
Report Abuse
drc3 is not online. drc3
Joined: 14 Aug 2009
Total Posts: 1284
05 Mar 2014 11:36 PM
It did not work...
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