Hello, I have a working door script that will allow me to move a single object like a part/union, but I want to change this so that I can move a door model instead. I thought that if I specified the model door like I did with a union, it would work the same. The best I've gotten was moving the primary part of the model, which just left everything else behind. I'm not sure how to specify the model and get all parts of the model to move.
The main error I am getting is
CFrame is not a valid member of Model "Workspace.Sliding Single Door.Door" - Server - SlidingSingleDoorScript:9
My code is:
open = false
local door = script.Parent.Parent.Parent.Door
local opensound = script.Parent.OpenSound
local closesound = script.Parent.CloseSound
local prompt = script.Parent
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local DoorOpen = {CFrame = door.CFrame * CFrame.new(-11,0,0)}
local DoorClose = {CFrame = door.CFrame}
local Open = TweenService:Create(door,tweenInfo,DoorOpen)
local Close = TweenService:Create(door,tweenInfo,DoorClose)
prompt.Triggered:Connect(function()
if open == false then
open = true
opensound:Play()
Open:Play()
wait(2)
else
closesound:Play()
Close:Play()
wait(2)
open = false
end
end)
BTW the prompt is a proximity prompt, which the script is inserted, everything else worked before, it's just changing the union doors to model doors is what's causing the issue.
Also everything in the model is properly welded together, if that is something necessary.
I really appreciate the help and advice, I am new to scripting :)
** You are now Level 2! **