i want to get player from character like inside the folder has a 10 character and i wanna make this all character into player
local characterFolder = workspace.Ingame:GetChildren() -- this one has a character inside a lot of character
for r = 1,#characterFolder do
local plr = game.Players:GetPlayerFromCharacter(characterFolder[r])
end
i have a problem that when i make the all character into player only one character is functioning
local characterFolder = workspace.Ingame:GetChildren() -- this one has a character inside a lot of character
for r = 1,#characterFolder do
local plr = game.Players:GetPlayerFromCharacter(characterFolder[r])
local lightwarn = plr:WaitForChild("PlayerGui").Warn -- only one player function and other is not working
lightwarn.Enabled = true
end
Do you receive any errors in the output log?
Well, idk what gamersplr is, but you should probably just use the player you just got!
local characterFolder = workspace.Ingame:GetChildren() -- this one has a character inside a lot of character
for r = 1,#characterFolder do
local plr = game.Players:GetPlayerFromCharacter(characterFolder[r])
local lightwarn =plr:WaitForChild("PlayerGui").Warn --
lightwarn.Enabled = true
end
I already but i wanna achievev like all character in the folder are going to be player cuz i wanna enabled gui so they can see the gui but only 1 player is functioning
1 Like
Yes, did you try the version of the code I just sent you? I changed it so its for each player, not just for one player named gamersplyr! try to read what I changed. Also here is my code in a format that I think is nicer but it is equivilant to above just formatted correctly, ok?
local characters = workspace.Ingame:GetChildren() -- this is not a folder, it is a list of characters
for _,character in pairs(characters) do -- for each loop is nicer than numeric for
local player = game.Players:GetPlayerFromCharacter(character) -- spell out words
local lightwarn = player:WaitForChild("PlayerGui").Warn -- use the player you just got instead of throwing it away
lightwarn.Enabled = true
end
ye i already did, i just misspell it
no i did not receive any error and also my problem is i want to get all player from character
No, You used a variable called gamersplyr or something, and you set his warning to enabled once for every character in the characters folder. now you actually use the player you get from each character and I think it might work. If you use my code.
2 Likes
So you want to get all players in game character via script, right?
1 Like
yes i want, cuz i make a script that all player’s character will move into folder and i want again the char move into playyer i made one but the script i made is only one player is function
i already made that one, and my problem is i want all character will be on plr so i can enabled the gui but only one player is functioning
it didnt work i try it but it didnt work
local Folder = game.Workspace.Characters_Folder
for i, v in pairs(Folder:GetChildren()) do
local CharacterName = v.Name
local LocalPlayer = game.Players:WaitForChild(CharacterName)
--- Do whatever you want.
break --- Only if you wanted do something 1 time.
end
1 Like
i tried but its not working only one player is functioning again