local Prisoners = "Prisoners" --Whatever name of the prisoner team is.
Teams = game:GetService("Teams")
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then --To check if it is a player
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player.Team == Teams[Prisoners] then --Check the original team
script.Parent.CanCollide = false
else
script.Parent.CanCollide = true
end
end
end)
I need a local script that will allow players from the Prisoners team to pass but not everyone else. But for some reason this does not work.
local part = workspace.antiSPAWNKILL
local Prisoners = "Prisoners" --Whatever name of the prisoner team is.
Teams = game:GetService("Teams")
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then --To check if it is a player
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player.Team == Teams[Prisoners] then --Check the original team
part.CanCollide = true
else
part.CanCollide = false
end
end
end)
local part1 = workspace.antiSPAWNKILL
local humanoid = part1:FindFirstChild("Humanoid")
local Prisoners = "Prisoners" --Whatever name of the prisoner team is.
Teams = game:GetService("Teams")
part1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then --To check if it is a player
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player.Team == Teams[Prisoners] then --Check the original team
part1.CanCollide = false
else
part1.CanCollide = true
humanoid.Health = humanoid.Health - 10
end
end
end)