Answered by
8 years ago Edited 8 years ago
You're using tabled wrong.
The GetChildren()
method returns a table of everything inside of whatever you called the function for.
ScriptGuider explains tables very well. Here's a link to his answer.
Your question,
For your question, we don't even need to use tables really. Besides looping through one. We're going to use a Pairs Loop
. A pairs loop will let us loop through everything inside of a table and give us the value in the table each loop.
01 | local player = game.Players.LocalPlayer |
02 | local character = player.Character or player.CharacterAdded:wait() |
04 | game:GetService( 'RunService' ).Stepped:connect( function () |
05 | local parts = character:GetChildren() |
06 | for i,v in pairs (parts) do |
I also waited for the character to load, and checked if what was inside the character was a part.
I'm not sure this is going to make the character a ghost, but this is a fix to your problem.
Good Luck!