Basically I am trying to make a arrest tool that will change the team of the player selected when the tool is activated. Here is the script I have created so far
--By: VineyardVine
local otherperson = nil
local otherhumanoid
mode = 1
sp = script.Parent
local me = game.Players.LocalPlayer
function changemode()
if mode == 1 then
mode = 2
script.Parent.Name = "Release Mode"
elseif mode == 2 then
mode = 1
script.Parent.Name = "Arrest Mode"
end
end
function arrest()
local target = Mouse.Target
if target and target.Parent then
local humanoid = target.Parent:FindFirstChild("Humanoid")
if target.Parent:IsA("Hat") and target.Parent.Parent then
humanoid = target.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
otherperson = game.Players:GetPlayerFromCharacter(humanoid.Parent)
otherhumanoid = humanoid
end
if otherperson and otherhumanoid and me:DistanceFromCharacter(humanoid.Parent.Head.Position) <= 5 and mode == 1 then
otherperson.TeamColor = "Really black"
otherhumanoid.Parent:BreakJoints()
end
end
end
function Equipped(mouse)
Mouse = mouse
end
sp.Activated:connect(arrest)
sp.Equipped:connect(Equipped,changemode)
