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

Player is not a valid member of DataModel?

Asked by 5 years ago
local Player = game.Players.LocalPlayer
    local inUse = false


    script.Parent:WaitForChild("Handle").Touched:connect(function(hit)
        local HH = hit.Parent:FindFirstChild("Humanoid")
        if HH and HH.Parent ~= Player.Character then
            if not inUse then
                inUse = true
                local name = HH.Parent.Name
                local gui = script.Parent.Arrest:clone()
                gui.Parent = Player.PlayerGui
                gui.Draggable.Frame.Value.Value = name
                gui.Draggable.Frame.TextLabel.Text = "Do you wish to arrest: "..name.."?"
                gui.Draggable.Frame.Visible = true

                    gui.Draggable.Frame.Confirm.MouseButton1Click:connect(function()
                        print('Arrest',gui.Draggable.Frame.Value.Value, gui.Draggable.Frame.Reason.Text)
                        inUse = false
                        local player = game.Player:FindFirstChild("plr")
                        local arrestplayer = game.Players:GetPlayerFromCharacter(HH.Parent)
                        gui:Destroy()
                            function setTeam(player, teamName)
    player.TeamColor = game.Teams[teamName].TeamColor
    if player.Character then --Just in case the character doesn't exist for some reason
        player.Character:BreakJoints() -- Kills the players' character
    end
end
                            setTeam(game.player.arrestplayer, "Prisoner")




                    end)

                    gui.Draggable.Frame.Cancel.MouseButton1Click:connect(function()
                        inUse = false
                        gui:Destroy()
                    end)
            end
        end
    end)
    script.Parent.Equipped:connect(function()
        inUse = false
        Player.Character.Humanoid.WalkSpeed = 28
    end)

    script.Parent.Unequipped:connect(function()
        inUse = false
        Player.Character.Humanoid.WalkSpeed = 16
    end)

That is my code, but the errors are saying that Player is not a valid member of DataModel. Error is on the 20th line. I wanted the script to be like, if press confirm(gui), set player prisoner, kill that person. and finish.

0
game.Players, not game.Player -_- User#24403 69 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

Line 20 should be local player = game.Players:FindFirstChild("plr") there might be more errors, but thats the immediate fix

0
dang it, ninja'd User#24403 69 — 5y
0
I still have the same problem Benjaemine -6 — 5y
0
get shrekt incaspaz Gey4Jesus69 2705 — 5y
Ad
Log in to vote
-3
Answered by 5 years ago
gui.Draggable.Frame.Confirm.MouseButton1Click:connect(function()
                        print('Arrest',gui.Draggable.Frame.Value.Value, gui.Draggable.Frame.Reason.Text)
                        inUse = false
                        local player = game.Players:FindFirstChild("plr")
                        local arrestplayer = game.Players:GetPlayerFromCharacter(HH.Parent)
                        gui:Destroy()
                            function setTeam(player, teamName)
    player.TeamColor = game.Teams[teamName].TeamColor
    if player.Character then --Just in case the character doesn't exist for some reason
        player.Character:BreakJoints() -- Kills the players' character
    end
end
                            setTeam(game.player.arrestplayer, "Prisoner")


I get the problem at 29th line of the code which is setTeam(game.player.arrestplayer, "Prisoner") Error: player is not a valid member of DataModel

3
OH MY GODDDDDKJRDLDLEOSJ;DLIHGPHJH0PTRIU LOOK AT LINE 13 OF THE SNIPPET User#24403 69 — 5y
0
haha like if you cried Optikk 499 — 5y

Answer this question