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

The morph tool Is saying In outpost "Players Is not a valid member of DataModel "Game""?

Asked by 2 years ago

So I am making a tool that whenever Its activated, It will select a random player model from a folder called "Characters" In ReplicaStorage, which Is going to transform the current player Into that said character, Im basically making a disguise watch that transform you Into a different player, to fool other players, but It appears to simply say when activated "Players Is not a valid member of DataModel "Game""

script:

local tool = script.Parent
local Rep = game.ReplicatedStorage
local CharacterFolder = Rep.Characters
local char = tool.Parent

tool.Activated:Connect(function()
    local player = game.players:GetPlayerFromCharacter(char)

    local RandomCharacter = math.random(1,3)

    if RandomCharacter == 1 then
        local AveragePlayer = CharacterFolder["Average player"]:Clone()
        AveragePlayer.Name = player.Name
        player.Character = AveragePlayer

        local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")
        local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character.Parent:FindFirstChild("Torso")

        if rootPart and plrRoot then
            rootPart.CFrame = plrRoot.CFrame
        end

        AveragePlayer.Parent = workspace
    end
    if RandomCharacter == 2 then
        local AveragePlayer = CharacterFolder.Girl:Clone()
        AveragePlayer.Name = player.Name
        player.Character = AveragePlayer

        local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")
        local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character.Parent:FindFirstChild("Torso")

        if rootPart and plrRoot then
            rootPart.CFrame = plrRoot.CFrame
        end

        AveragePlayer.Parent = workspace
    end
    if RandomCharacter == 3 then
        local AveragePlayer = CharacterFolder.Troll:Clone()
        AveragePlayer.Name = player.Name
        player.Character = AveragePlayer

        local rootPart = AveragePlayer:FindFirstChild("HumanoidRootPart") or AveragePlayer:FindFirstChild("Torso")
        local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character.Parent:FindFirstChild("Torso")

        if rootPart and plrRoot then
            rootPart.CFrame = plrRoot.CFrame
        end

        AveragePlayer.Parent = workspace
    end
    tool:Destroy()
end)

Answer this question