Answered by
5 years ago Edited 5 years ago
You basically want to kill a player if their item is touching a part, right?
this is a script to kill the player if either that player or their item is on a part;
02 | function onTouched(part) |
03 | local hum = part.Parent.Humanoid |
05 | local tool = part:FindFirstAncestorWhichIsA( "Tool" ) |
07 | hum = tool.Parent.Humanoid |
16 | MyKillBrick.Touched:Connect(onTouched) |
If this doesnt work or isnt what you intended, comment on this and I'll see what I can do. If it is good, you can accept my answer ;)
IGNORE EVERYTHING BEFORE HERE
EDIT:
Try this. Put these 1st script in the part you want and put a BoolValue named "TouchingFloor" in StarterCharacterScripts
1st Script:
02 | local hum = part.Parent.Humanoid |
04 | part.Parent.TouchingFloor.Value = false |
07 | function onTouched(part) |
08 | local hum = part.Parent.Humanoid |
10 | part.Parent.TouchingFloor.Value = true |
13 | script.Parent.TouchEnded:Connect(onLeft) |
14 | script.Parent.Touched:Connect(onTouched) |
Here is the second script. Put this also in StarterCharacterScripts:
03 | if script.Parent.TouchingFloor.Value = = false then |
07 | until x = = 5 or script.Parent.TouchingFloor.Value = = true |
08 | if script.Parent.TouchingFloor.Value = = false then |
09 | script.Parent.Humanoid.Health = 0 |
This will Punish the player for having none of them touch the floor (or whatever part) for over a 1/2 second. I did this because their animation might have them leave the floor for a split second. Respond if this doesnt work and i'll get back to you ASAP