I'm trying to make a character swap system, something similar to genshin impact but I'm having quite bit of trouble getting a small part through. So there is a local script that changes a stringvalue's value to a different name and then if it has been changed it fires a remoteevent on server side which has to change the player's appearance and everything works until this lines of code:
for i,v in pairs(rs:GetChildren()) do if v.Name == cf.Current.Value then print(v.Name) end end
you can ignore the print(v.Name) part because its just a way to debug.
The issue there is that it doesn't find any folders with the same name as the value in the stringvalue.
for i,v in pairs(rs:GetChildren()) do if v.Name ~= cf.Current.Value then print(v.Name) end end
^ This version of the code makes it so everything in "rs" get printed even if it has the same name as the value in the stringvalue so i think the issue is in the value itself but i cannot find why
I can help you with this.
Ok, first you want to get the location of the folder. For this example, the location is in the workspace.
game.Workspace
Then get the String Value's value. Then getting the folder would be as simple as this.
local string = -- the string value local folder = game.Workspace[string]
Now "folder" is the folder you are trying to get.
Hope this helps!
"The problem is that you're changing the value on the client and comparing that same value on the server." ~ R_alatch
he won't put it as an answer so i'm doing it myself