I want to bring all the " Main " but theres more than one group of them and it just tps one to me, how to make it work?
for index, object in next, game:GetService("Workspace").Entities["OP Money Printer"]:GetChildren() do
if object:IsA('Part') then
if object.Name == "Main" then
game:GetService("Workspace").Entities["OP Money Printer"].Main.CFrame = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame
end
end
end
for i in pairs(workspace.Entities["OP Money Printer"]:GetChildren()) do
if object:IsA(‘Part’) then
if object.Name == “Main” then
i.CFrame = CFrame.new(game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").CFrame)
end
end
Also, I highly recommend formatting your code, as well as putting it inside of two ```'s.
for i in pairs(workspace.Entities["OP Money Printer"]:GetChildren()) do
if object:IsA("Part") then
if object.Name == "Main" then
i.CFrame = CFrame.new(game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").CFrame)
end
end
end
for index, object in next, game:GetService("Workspace").Entities["OP Money Printer"]:GetChildren() do
if object:IsA('Part') then
if object.Name == "Main" then
object.CFrame = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame
end
end
end
for index, object in pairs(game:GetService("Workspace").Entities:GetDescendants()) do
if object:IsA('Part') then
if object.Name == "Main" and object.Parent.Name == "OP Money Printer" then
object.CFrame = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame
end
end
end