Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you use :GetChildren() properly?

I need help with this.

local victim = iiDkOffical
local victimpart = workspacevictim:GetChildren()
local workspacevictim = game.Workspace.victim
local player = game.Workspace.iiDkOffical
local humanoid = player.Character.HumanoidRootPart
local cframe = humanoid.CFrame
local invispart = player:GetChildren()
invispart.Transparency = 1
victimpart.CanCollide = false
victimpart.Anchored = true
while wait() do
victimpart.CFrame = cframe
wait(0.01)
end

I want a player to teleport to someone else until the script stops, and make me invisible.

1 answer

It's simple, after using GetChildren(), it gives you a table of items. You just have to loop through each of them.

local invispart = player:GetChildren()
for _, Parts in pairs(invispart) do
	if Parts:IsA("Basepart") then
		Parts.Transparency = 1
	end
end
local victimpart = workspacevictim:GetChildren()
for _, Parts in pairs(victimpart) do
	if Parts:IsA("Basepart") then
		victimpart.CanCollide = false
victimpart.Anchored = true
	end
end

Hope it helps! :D

This discussion is preserved as it was. New answers, comments, and votes are closed.