Hey! I was told to find some anti-random kill system, but it isn’t working. I followed the tutorial the script came with and it still doesn’t work. Here is the script.
local groupid = 14693154 -- Group ID goes here
local rankbypass = 251 -- Rank in group to bypass the anti-RK system
local WarningLeft = 3 -- How many warnings before punishment
local ImmigrantTeam = game.Teams.Travelers
game.Players.PlayerAdded:Connect(function(Player)
local Warnings = Instance.new("IntValue")
Warnings.Parent = Player
Warnings.Name = "Warnings"
Player.CharacterAdded:Connect(function(Char)
if Player.Team == ImmigrantTeam then
local Hostile = Instance.new("BoolValue")
Hostile.Name = "Hostile"
Hostile.Parent = Char
local PHostile = Instance.new("BoolValue")
PHostile.Name = "PotentialHostile"
PHostile.Parent = Char
local Humanoid = Char:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Died:Connect(function()
if not Hostile.Value and not PHostile.Value then
local creatorTag = Humanoid:FindFirstChild("creator")
if creatorTag and creatorTag.Value then
local KillerPlr = creatorTag.Value
if KillerPlr.Team ~= ImmigrantTeam and KillerPlr:GetRankInGroup(groupid) <= rankbypass then
if game.ReplicatedStorage:FindFirstChild("Warn") then
game.ReplicatedStorage.Warn:Fire(KillerPlr)
end
end
end
end
end)
end
Char.ChildAdded:Connect(function(Child)
if Child:FindFirstChild("Illegal") then
Hostile.Value = true
end
end)
end
end)
end)
if game.ReplicatedStorage:FindFirstChild("Warn") then
game.ReplicatedStorage.Warn.OnServerEvent:Connect(function(Player)
local Warnings = Player:FindFirstChild("Warnings")
if Warnings then
Warnings.Value += 1
if Warnings.Value >= 3 then
Player:Kick("You random killed, you silly boi.")
end
end
end)
end
for _, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "RestrictedPart" then
v.Touched:Connect(function(Part)
local Char = Part.Parent
if Char and Char:FindFirstChild("Hostile") and Part.Name == "HumanoidRootPart" then
Char.Hostile.Value = true
end
end)
elseif v.Name == "PartialRestrictedPart" then
v.Touched:Connect(function(Part)
local Char = Part.Parent
if Char and Char:FindFirstChild("PotentialHostile") and Part.Name == "HumanoidRootPart" then
Char.PotentialHostile.Value = true
end
end)
v.TouchEnded:Connect(function(Part)
local Char = Part.Parent
if Char and Char:FindFirstChild("PotentialHostile") and Part.Name == "HumanoidRootPart" then
Char.PotentialHostile.Value = false
end
end)
elseif v.Name == "AntiRockWall" then
v.Touched:Connect(function(Part)
local Char = Part.Parent
if Char and Char:FindFirstChild("Humanoid") and Part.Name == "HumanoidRootPart" then
local Player = game.Players:GetPlayerFromCharacter(Char)
if Player and Player.Team == game.Teams["Knights"] and Player:GetRankInGroup(groupid) < WarningLeft then
Char.Humanoid.Health = 0
end
end
end)
end
end
end