Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 24 Jul 2013 11:13 AM |
So I need a anti teamkill script I can paste into workspace, I think of making the script inside a character. I dont know how I would use the (damage) tooken from the character in the function heal()
Ex: local char = script.Parent local human = char.Humanoid local health = human.Health local plr = game.Players[char.Name]
function heal(damage) if human:FindFirstChild("creator") then local cr = game.Players[creator.Value] if plr.TeamColor == cr.TeamColor then human.Health = human.Health + damage end end
human.Changed:connect(function(prop) if prop == "Health" then heal() end end) |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
| |
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
| |
|
Parthax
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 6941 |
|
|
| 24 Jul 2013 11:39 AM |
make a variable beforehand so that you can heal their maxhealth minus this variable, then just set the variable to their current health logic
|
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 24 Jul 2013 12:46 PM |
There's no way to make a script in the workspace to do anti-teamkill. It will only do mostly-anti-teamkill. Also, it won't work at all for any sort of rockets that use explosions, or do 1-hit kills in other ways.
So, you really need to have the weapons aware of teams, not just a script in the workspace. |
|
|
| Report Abuse |
|
|
Parthax
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 6941 |
|
|
| 24 Jul 2013 01:18 PM |
@stravant reload their character, set their torso to the cframe that it was before they died, set their health and maxhealth to what it was before they took damage, whenever they take damage |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 24 Jul 2013 01:53 PM |
| Not a solution since loading the tools in the backpack takes up to a few seconds, so even if you do it perfectly there will be a noticeable hiccup. |
|
|
| Report Abuse |
|
|
Parthax
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 6941 |
|
|
| 24 Jul 2013 02:01 PM |
| clone tools before they die, and just parent them, and wait for a new tool that they would receive, then destroy it |
|
|
| Report Abuse |
|
|