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

Connecting CFrame by using In pairs loop to another model. [Solved]?

Asked by 8 years ago

Okay so is this at a certain time it activates. Works great, don't mess with it,

-However what I am trying to do is move the spawns at a certain time. Without all the mumble jumble of changing each individual's CFrame and Rotation separately.

I am wanting to use In Pairs loop to find all the parts in the spawn model, then go to a different model and find the name of that single part and change its CFrame to that part's CFrame.

So basically, I have a model with different area spawns in it. I have another model with just a bunch of parts. with the exact same names at the spawn locations. It is suppose to and get lets say 'ZTele1' (which is a spawn), and go into the parts model and find ZTele1 (as a part) and get that location and change the original spawn location to that specific part's location.

Here is the script:

port = script.Parent.Parent.ZombiesTele
fix = script.Parent.Parent.ZombieSpawnFixer
local Count = script.Counter
local area3 = port.Area3
local level2 = fix.LevelTwoFix
local change3 = level2.Area3

game.Workspace.TimerCounter.Changed:connect(function(val) 
    if val == 390 then
        for Distance=1,0, -1 do
            wait()
            Count.Value = Distance
            for i, v in pairs (area3:GetChildren()) do
                v.CFrame = CFrame.new(change3.v.Cframe)
            end 
        end
    end
end)

However everytime I run this it says the "v" is a nil value. at "(change3.v.CFrame)" aka: v is not a valid member of model (The parts model)

0
It should be change3[v.Name].CFrame because this script is looking for the exact 'v' part, not it's name. TheDeadlyPanther 2460 — 8y
0
thank you it worked :D CarterTheHippo 120 — 8y
0
Please mark your question as solved. MrNicNac 855 — 8y

Answer this question