I'm not really good in CFrame so can you help me for fix this?:/
15:25:48.386 - Workspace.Gate.Script:8: bad argument #2 to '?' (Vector3 expected, got CFrame)
deboulse = false script.Parent.Button.ClickDetector.MouseClick:connect(function(player) if deboulse == false then deboulse = 2 print(player.Name.." open door") for index, door in pairs(script.Parent.Parts:GetChildren()) do for i = 0,100 do door.CFrame = door.CFrame-CFrame.new(0,0,-4) wait() end end for index, light in pairs(script.Parent.lights:GetChildren()) do light.Color = BrickColor.new("Really red") end script.Parent.lights.BrickColor = BrickColor.new("Really red") deboulse = true elseif deboulse == true then deboulse = 2 print(player.Name.." close door") for index, door in pairs(script.Parent.Parts:GetChildren()) do for i = 0,100 do door.CFrame = door.CFrame-CFrame.new(0,0,4) wait() end end for index, light in pairs(script.Parent.lights:GetChildren()) do light.Color = BrickColor.new("Institutional white") end script.Parent.lights.BrickColor = BrickColor.new("Institutional white") deboulse = false end end)
Explorer: https://gyazo.com/ebc068f3ba1378368b4869dab81c79a6
You can't add and subtract CFrames. CFrames are really just matrices, which don't have a standardized form of addition or subtraction.
It sounds like you just want to translate the CFrame. Replace CFrame.new(x, y, z)
with Vector3.new(x, y, z)
. It comes up on lines 9 and 23 in the code you posted.