Please help, just stop viewing it only. You are scripters. Don't be anonymous/unknown.
script.Parent.PrimaryPart = script.Parent.Hinge
hit = false
script.Parent.Parent.Part1.Touched:connect(function()
if hit == false then
hit = true
local i = 0
while i <= 120 do
wait()
script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
i = i + 5
end
wait(3)
local i = 120
while i >= 0 do
wait()
script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Hinge.Position) * CFrame.Angles(0, math.rad(i), 0)) --Rotates Door
i = i - 5
end
hit = false
end
end)

2 comments
If you don't know how to do something, search it on the wiki or use the search bar of this website. That will then link you to questions that are related to what you're after so you can then implement that into your own script
Well, the thing is. I get confused a lot with Lua although I'm a medium-scripter. >_>