Here's what I mean: When you touch the part, right away it destroys the children. It doesn't matter if you're still touching the part... How can I fix this?
(TouchEnded is at the bottom)
open = script.Parent.Opened Ready = true Ready2 = true function kk(plr, value) repeat wait() script.Parent.Opened.Value = value until script.Parent.Opened.Value == true end function kk2(plr, value2) repeat wait() script.Parent.Opened.Value = value2 until script.Parent.Opened.Value == false end script.Parent.Touched:Connect(function(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then if Ready == true and open.Value == false and Ready2 == true then Ready = false note = script.Parent.NoteOpen:Clone() note.Parent = plr.PlayerGui scri = script.Parent.OpenScript:Clone() scri.Parent = plr.PlayerGui scri.Disabled = false script.Parent.OpenOrClose.OnServerEvent:Connect(kk) repeat wait() until script.Parent.Opened.Value == true script.Parent.Parent.D1.Part0.Motor.DesiredAngle = 1.3 note:Destroy() scri:Destroy() Ready2 = false elseif Ready == false and open.Value == true and Ready2 == false then Ready = true note = script.Parent.NoteClose:Clone() note.Parent = plr.PlayerGui scri = script.Parent.CloseScript:Clone() scri.Parent = plr.PlayerGui scri.Disabled = false script.Parent.OpenOrClose.OnServerEvent:Connect(kk2) repeat wait() until script.Parent.Opened.Value == false script.Parent.Parent.D1.Part0.Motor.DesiredAngle = 0 note:Destroy() scri:Destroy() Ready2 = true end end end) script.Parent.TouchEnded:Connect(function(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then if plr.PlayerGui:FindFirstChild("OpenScript") then plr.PlayerGui.OpenScript:Destroy() end if plr.PlayerGui:FindFirstChild("NoteOpen") then plr.PlayerGui.NoteOpen:Destroy() end if plr.PlayerGui:FindFirstChild("CloseScript") then plr.PlayerGui.OpenScript:Destroy() end if plr.PlayerGui:FindFirstChild("NoteClose") then plr.PlayerGui.NoteOpen:Destroy() end end end)