Hello, I am making a horror game that you have to close the doors so the monsters wont kill you, but I am having a problem. The problem is, is when I open the door the kill brick script disabled property should turn into false (it is true in the beginning of the game) but when the player keeps the door keeps the door is close the disabled property of the kill brick will stay at true. but the problem I am having is when you open the close the door the kill brick's disabled property is set to false instead of being true when you closed the door. Code:
local tween = game:GetService("TweenService")
local center = script.Parent.Center
local door = "Closed"
local CF = Instance.new("CFrameValue")
CF.Value = center.CFrame
CF.Changed:Connect(function()
center.CFrame = CF.Value
end)
script.Parent.Door.ClickDetector.MouseClick:Connect(function()
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"
wait(3)
game.Workspace.KillBrick1.Script.Disabled = false
else
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 = "closed"
game.Workspace.KillBrick1.Script.Disabled = true
end
end)
