While clicking on myself to test a tool I've made, I've been getting 20:36:34.831 - Players.Player1.Backpack.Arrest Tool.LocalScript:10: attempt to call field 'Button1Down' (a userdata value). I checked SH and found someone getting the same error, but they forgot a comma. I'm pretty sure I've written everything correctly, but apparently not. Thank you for any and all help!
tool = script.Parent
local canArrest = false
local mouse = game.Players.LocalPlayer:GetMouse()
tool.Equipped:connect(function()
canArrest = true
if canArrest == true then
local target = mouse.Target
local char = target.Parent
local player = game.Players:GetPlayerFromCharacter(char)
mouse.Button1Down():connect(function()
if player then
local pTeam = player.Team
player.Team = "Jailed"
char.Humanoid.Health = 0
wait(120)
player.Team = pTeam
end
end)
end
end)
tool.Unequipped:connect(function()
canArrest = false
end)
