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

why are unions not moving in moving door?

Asked by 4 years ago

Every time I try to make a moving door with unions the parts move but the unions dont. is there any way to make it work, because making a vault door without unions will be hard this is what i have so far

**function Activate() if script.Parent.Parent.Active.Value == true and script.Parent.Parent.Power.Value == true then wait(2) local g = script.Parent:GetChildren() for b = 1, 40 do for i = 1, # g do if g[i].className == "Part" then g[i].CFrame = g[i].CFrame + Vector3.new(0, 0, .05) end end wait(.025) end wait(2) for b = 1, 185 do for i = 1, # g do if g[i].className == "Part" then g[i].CFrame = g[i].CFrame + Vector3.new(0.1, 0, 0) end end wait(.05) end script.Parent.Parent.Valid.Value = true elseif script.Parent.Parent.Active.Value == false then wait(2) local g = script.Parent:GetChildren() for b = 1, 185 do for i = 1, # g do if g[i].className == "Part" then g[i].CFrame = g[i].CFrame + Vector3.new(-0.1, 0, 0) end end wait(.05) end wait(2) for b = 1, 40 do for i = 1, # g do if g[i].className == "Part" then g[i].CFrame = g[i].CFrame + Vector3.new(0, 0, -.05) end end wait(.025) end script.Parent.Parent.Valid.Value = true end end

script.Parent.Parent.Active.Changed:connect(Activate)**

1 answer

Log in to vote
0
Answered by
pidgey 548 Moderation Voter
4 years ago

Check if the unions & parts are BasePart, not Part. All different part types extend from BasePart. Only parts are parts Objects can be of many forms ex: BasePart -> Part. To check if a part is of the BasePart type, use the IsA function ex:

if part:IsA("BasePart") then

or

if g[i]:IsA("BasePart") then
Ad

Answer this question