I was trying to make a script where it selects a random character out of a folder and copies it and puts it into place. I got stumped when I tried to figure out how to grab that character out of the folder. I already made a random selector I just need help with the getting the character from the table part.
Script:
ProxPromt.Triggered:Connect(function(plr)
local SelectedCharacter = math.random(1, #Characters:GetChildren())
You’re half way there! You just need to grab that random selected number from a list of children from that folder. It would look something like this:
ProxPromt.Triggered:Connect(function(plr)
local CharacterList = Characters:GetChildren()
local RandCharacter = math.random(1, #CharacterList)
local SelectedCharacter = CharacterList[RandCharacter]
Your math.random generated a random number to select from the # of characters in the folder. Now you can just select the character from the list with that number by doing CharacterList[RandCharacter]
I’m not 100% sure if the code works above, wrote it on my phone, but should be enough to deliver the right idea.