Hello devforum, I have a problem with a door script:
When a value is true you shouldnt be able to open it, but for some reason its like if the if statement didn’t work.
Script:
clickd.MouseClick:Connect(function(player)
if script.Parent.Parent.Locked.Value == false then
if opened.Value == false then
sound:Play()
opened.Value = true
mainpart.CFrame = script.Parent.Parent.Door2.CFrame
else
sound:Play()
opened.Value = false
mainpart.CFrame = script.Parent.Parent.Door1.CFrame
end
elseif script.Parent.Parent.Locked.Value == true then
print("Its locked")
end
end)
Perhaps you should add a wait function for the player to have enough time to go through the door, also why are you checking the Locked value ? This may also be your problem as instead you could just use the opened value.