Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you use :GetChildren() properly?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question