I am trying to make a arrest script for my game. So when I try clicking on "player2" it displays an error.
Error: "Character is not a valid member of model"
LocalScript:
script.Parent.Equipped:connect(function()
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:connect(function()
if mouse.Target.Name == "Left Leg" or mouse.Target.Name == "Left Arm" or mouse.Target.Name == "Right Leg" or mouse.Target.Name == "Right Arm" or mouse.Target.Name == "Head" or mouse.Target.Name == "Torso" then
print(mouse.Target.Parent)
mouse.Target.Parent.Character.Torso.Anchored = true
player.PlayerGui.Arrest.Frame.Visible = true
player.PlayerGui.Arrest.Suspect.Value = mouse.Target.Parent
player.PlayerGui.Arrest.Frame.TextLabel.Text = "Arrest "..mouse.Target.Parent.Name.."?"
end
end)
end)

5 comments
What line?
mouse.Target.Parent.Character I don't think it works like that dude :/ you should do mouse.Target.Parent.Torso
.Character is a part of a player, not workspace
oh yeah I forgot.
If Redcommander answered your question, go ahead and write [Fixed] or [Solved] next to the question title so that no one else tries to resolve it.