I’ve tried many way’s until my script got broken out of nowhere and this is a new way I was trying but it’s not working fully… Can someone help me fix it?
local Team = game:GetService("Teams")["Republic"]
local Team2 = game:GetService("Teams")["Empire"]
function onTouch(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Team == Team then
script.Parent.CanCollide = false
wait(1)
script.Parent.CanCollide = false
---------
if player.Team == Team2 then
local Humanoid = player:WaitForChild("Humanoid")
Humanoid.Health = 0
--------------
end
end
end
script.Parent.Touched:Connect(onTouch)
local Team1= game:GetService("Teams")["Republic"]
local Team2 = game:GetService("Teams")["Empire"]
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Team.Name == Team1.Name then
script.Parent.CanCollide = false
task.wait(1)
script.Parent.CanCollide = false
elseif player.Team.Name == Team2.Name then
local Humanoid = player:WaitForChild("Humanoid")
Humanoid.Health = 0
end
end
end
script.Parent.Touched:Connect(onTouch)
local Team1= game:GetService("Teams")["Republic"]
local Team2 = game:GetService("Teams")["Empire"]
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Team.Name == Team1.Name then
script.Parent.CanCollide = false
task.wait(1)
script.Parent.CanCollide = false
elseif player.Team.Name == Team2.Name then
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.Health = 0
end
end
end
script.Parent.Touched:Connect(onTouch)
you did alot lol i knew some was but you did what i overlooked thanks soo much
and I been trying to do a anti-team kill with my tool to where if i switch teams it works regardless without setting it to one team then duplicating it for the other team