I have 2 Folder and each has an Object called Ball (Soccer Ball) I don’t know how to make the other folder to get to the Soccer Ball folder’s part CFrame
local ClientControlBall = game.Workspace.SoccerBall.ClientControlBall
local SoccerBall = game.Workspace.SoccerBall
for i,ClientBall in pairs(ClientControlBall:GetChildren()) do
if ClientBall:IsA("BasePart") then
for _,ServerBall in pairs(SoccerBall:GetChildren()) do
if ServerBall:IsA("BasePart") then
ClientBall.CFrame = ServerBall.CFrame
end
end
end
end
I would Recommend naming the balls something like: Ball1 Ball2 OtherBall1 OtherBall2
for number, CBall in ClientControlBall:GetChildren() do
if CBall:IsA("BasePart") then
CBall.CFrame = SoccerBall["Other"..tostring(CBall)].CFrame
end
end
I tried this but it just follows to one Ball I’m trying to get the Ball to follow the ball that is outside of the Folder of ClientControlBall so it follows the one that’s inside SoccerBall instead.
This time I re-named to Other on the ball outside of the ball no matter what it’s still on the same position.
local ClientControlBall = game.Workspace.SoccerBall.ClientControlBall
local SoccerBall = game.Workspace.SoccerBall
for number, CBall in ClientControlBall:GetChildren() do
if CBall:IsA("BasePart") then
CBall.CFrame = SoccerBall["Other"..tostring(CBall)].CFrame
end
end
Nevermind. I figured it myself. instead of naming them through 1 2 3 4 5 infinitely ima just save the SoccerBall’s CFrame to a table. thanks for the help.