Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved] Trying to make a arrest script, but it displays an error?

Asked by
RootEntry 111
6 years ago
Edited 6 years ago

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)
0
What line? User#20388 0 — 6y
0
mouse.Target.Parent.Character I don't think it works like that dude :/ you should do mouse.Target.Parent.Torso User#20388 0 — 6y
0
.Character is a part of a player, not workspace User#20388 0 — 6y
0
oh yeah I forgot. RootEntry 111 — 6y
0
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. Troidit 253 — 6y

Answer this question