Hello, I'm trying to make animated doors with if command. I get this error, no clue what's wrong. Anyone know how to fix this?
local lockdownyesno = script.Parent.Parent.Lockdown
local tween = game:GetService("TweenService")
local center = script.Parent.Parent.Parent.Center
local Door = "Closed"
local CF = Instance.new("CFrameValue")
CF.Value = center.CFrame
CF.Changed:Connect(function()
center.CFrame = CF.Value
end)
local debounce = true
if debounce then
debounce = false
script.Parent.Parent.Parent.Parent.Touched:Connect(function()
if lockdownyesno.Value == 1 then
debounce = true
if Door == "closed" then
tween:Create(CF, TweenInfo.new(1, Enum.EasingStyle.Quart), {Value = center.CFrame * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))}):play()
Door = "open"
elseif
tween:Create(CF, TweenInfo.new(1, Enum.EasingStyle.Quart), {Value = center.CFrame * CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))}):play()
then Door = "closed"
end
wait(1)
debounce = false
end
end
)
end
Error: Center is not a valid member of Workspace
Workspace: https://gyazo.com/e13942fbe3cd28c3d11c49cb4efc35d8

2 comments
Thanks! That's work. But now there is error " 17:01:59.217 - Touched is not a valid member of DataModel"
That's the same thing, you're directing the script to workspace, and not the model, again.