Firstly, don’t place the print in the for loop. Place it before the for loop (as in, on the second line)
Secondly, you didn’t change the line that I said to change lol
this is what I meant:
return function (_, players, clanname, clans: string)
print(clanname)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder[clanname].Value
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
Firstly, can you show me the entire console? I want to see if the print actually printed anything. Secondly, I believe the issue currently is that clanname is actually a folder (strange), in which case try changing it to “clans” instead (the lowercase one)
return function (_, players, clanname, clans: string)
print(clanname)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder.Value
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
return function (_, players, clanname, clans: string)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder[clans].Value
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
This is my original script and it works like I showed you before, but it shows the folder name, about the “clanname” is nothing, it doesn’t have anything added.
return function (_, players, clanname, clans: string)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder[clans].Value
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
wait do each of those string values not have values?
ok use this ig
return function (_, players, clanname, clans: string)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder[clans]
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
Original script (Works) but doesn’t show clan names, only folder name.
return function (_, players, clanname, clans: string)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder.Name
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
This is the string value where it should give the name of the clan, but gives the folder name.
And this is the folder location, clans and names of clans.
return function (_, players, clanname, clans: string)
print(clans)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder.Name
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end
return function (_, players, clans: string)
print(clans)
for _, player in pairs(players) do
local character = player.Character
if character then
local Clanfolder = game.ReplicatedStorage:WaitForChild("Clans")
local ClanValue = character:WaitForChild("Clan")
if ClanValue then
if ClanValue.Value ~= "none" then
local Clans = ClanValue
if Clans then
player.Character.Clan.Value = Clanfolder.Name
end
end
end
return ("Assigned clan to Player."):format(#players)
end
end
end