When your mouse hovers over this part, it functions nude, then checks to see if this bool value is true or false. If it is true it closes the door and disables the script, if it isn't true it just disables the script. I have many identical scripts within my game however, this one doesn't seem to function after the nude function...
function nude() kk = game.Workspace.Hello1:GetChildren() kkk = game.Workspace.Hello1.D1:GetChildren() for i,v in pairs(kk) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end for i,v in pairs(kkk) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end jj = game.Workspace.Hello2:GetChildren() jjj = game.Workspace.Hello2.D1:GetChildren() for i,v in pairs (jj) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end for i,v in pairs(jjj) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end end Ready = true script.Parent.ClickDetector.MouseHoverEnter:Connect(function() Ready = false nude() if game.Workspace.CloseMe.D1.Opened.Value == true then game.Workspace.CloseMe.D1.Part0.DesiredAngle = 0 game.Workspace.CloseMe.D1.Opened.Value = false game.Workspace.CloseMe.D1.Handle.Script.Disabled = true elseif game.Workspace.CloseMe.D1.Opened.Value == false then game.Workspace.CloseMe.D1.Opened.Value = true game.Workspace.CloseMe.D1.Handle.Script.Disabled = true end game.Workspace.CreepyPaintingArea:Destroy() game:GetService("ReplicatedStorage").Storage.OfficeArea.Parent = game.Workspace wait(3) game.Workspace.Office.Gunshot.Barking:Play() game.Workspace.Office.Gunshot.Gun:Play() game.Workspace.Office.Gunshot.PointLight.Enabled = true wait(0.3) game.Workspace.Office.Gunshot.PointLight.Enabled = false game.Workspace.CloseMe.D1.Handle.Script.Disabled = false script.Parent:Destroy() end)
User "MouseEnter" instead
function nude() kk = game.Workspace.Hello1:GetChildren() kkk = game.Workspace.Hello1.D1:GetChildren() for i,v in pairs(kk) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end for i,v in pairs(kkk) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end jj = game.Workspace.Hello2:GetChildren() jjj = game.Workspace.Hello2.D1:GetChildren() for i,v in pairs (jj) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end for i,v in pairs(jjj) do if v.ClassName == "Part" then v.Transparency = 0 v.CanCollide = true end end end Ready = true script.Parent.ClickDetector.MouseEnter:Connect(function() Ready = false nude() if game.Workspace.CloseMe.D1.Opened.Value == true then game.Workspace.CloseMe.D1.Part0.DesiredAngle = 0 game.Workspace.CloseMe.D1.Opened.Value = false game.Workspace.CloseMe.D1.Handle.Script.Disabled = true elseif game.Workspace.CloseMe.D1.Opened.Value == false then game.Workspace.CloseMe.D1.Opened.Value = true game.Workspace.CloseMe.D1.Handle.Script.Disabled = true end game.Workspace.CreepyPaintingArea:Destroy() game:GetService("ReplicatedStorage").Storage.OfficeArea.Parent = game.Workspace wait(3) game.Workspace.Office.Gunshot.Barking:Play() game.Workspace.Office.Gunshot.Gun:Play() game.Workspace.Office.Gunshot.PointLight.Enabled = true wait(0.3) game.Workspace.Office.Gunshot.PointLight.Enabled = false game.Workspace.CloseMe.D1.Handle.Script.Disabled = false script.Parent:Destroy() end)
Also instead of saying "if v.ClassName == "Part" then" you should do "if v:IsA("BasePart") then"
The problem is that MouseHoverEnter isn't a valid member of ClickDetector, to make it work; use MouseEnter instead for the hovering to be detected.