Ok so I want to get the player from all of the characters in this folder so I can access their backpack and a custom inventory folder.
Here is my code:
for i = 1, #players do
playerthing = players[i]
actualplayer = playerthing:GetPlayerFromCharacter()
playerweapons = actualplayer.Inventory:GetChildren()
playerweapons.Parent = actualplayer.Backpack
here is the error I get
GetPlayerFromCharacter is not a valid member of Model "Workspace.PlayersMap.epicnmac"
Full Code:
while true do
wait (0.5)
if game.ServerStorage.Map.Players.Value == 1 then
for i = 19,1,-1 do game.ServerStorage.Map.Time.Value = i wait (1) end
if game.ServerStorage.Map.Time.Value == 0 then
print "LoadedMap"
local themap = game.ServerStorage.Map.Build:Clone()
themap.Parent = game.Workspace
tpposy = math.random(0,100000)
tpposx = math.random(0,100000)
tpposz = math.random(0,100000)
themap.Part.Position = Vector3.new (tpposy,tpposx,tpposz)
print (tpposx)
wait (1)
local players = game.Workspace.PlayersMap:GetChildren()
for i = 1, #players do
playerthing = players[i]
rootpart = players[i].HumanoidRootPart
playerparent = players[i].Parent
wait (0.5)
rootpart.CFrame = CFrame.new(tpposy,tpposx,tpposz)
rootpart.CFrame = CFrame.new(tpposy,tpposx,tpposz)
rootpart.CFrame = CFrame.new(tpposy,tpposx,tpposz)
rootpart.CFrame = CFrame.new(tpposy,tpposx,tpposz)
wait (1)
playerparent = game.Workspace
print "Parent Changed"
game.ServerStorage.Map.Players.Value = 0
game.ServerStorage.Map.Closed.Value = true
actualplayer = game.Players:GetPlayerFromCharacter(playerthing)
playerweapons = actualplayer.Inventory:GetChildren()
playerweapons.Parent = actualplayer.Backpack
end
end
end
end
