Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am struggling to make an anti-TK weapon can anyone help?

  script.Parent.blade.Touched:connect(function(p)

  if script.Parent.CanDamage.Value == true then

  script.Parent.CanDamage.Value = false

  p.Parent.Humanoid:TakeDamage(6)	
  end
  end)

Here is the weapon I want to be anti team kill but I don't know how to make it that way. Is there anyone who show me how to add a anti-TK part to this? Cause it is so frustrating I've looked everywhere and there's no tutorials or anything on how to make a player on a team ignore damage there's only scripts that kills both players so please help me.

1 comment

0

You should show what you've tried, places you've looked, and what exactly you don't understand. Asking how to do things without having tried to do the thing isn't constructive.

1 answer

Worth a shot.

script.Parent.blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
if game.Players:GetPlayerFromCharacter(p.Parent) then
if game.Players:GetPlayerFromCharacter(p.Parent).TeamColor ~= game.Players.LocalPlayer.TeamColor and p.Parent ~= game.Players.LocalPlayer.Character then
script.Parent.CanDamage.Value = false
p.Parent.Humanoid:TakeDamage(6)   
end
end
end
end)

1 comment

0

Explain your answers.

This discussion is preserved as it was. New answers, comments, and votes are closed.