(closing script)
door = script.Parent.Parent.Door
function onClicked()
if door.open.Value == true then
door.open.Value = false
door.CanCollide = true
wait(0.01)
door.Transparency = 1
wait(0.01)
door.Transparency = 0.9
wait(0.01)
door.Transparency = 0.8
wait(0.01)
door.Transparency = 0.7
wait(0.01)
door.Transparency = 0.6
wait(0.01)
door.Transparency = 0.5
wait(0.01)
door.Transparency = 0.4
wait(0.01)
door.Transparency = 0.3
wait(0.01)
door.Transparency = 0.2
wait(0.01)
door.Transparency = 0.1
wait(0.01)
door.Transparency = 0
wait(0.01)
end
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)
(opening door)
door = script.Parent.Parent.Door
function onClicked()
if door.open.Value == false then
door.open.Value = true
door.CanCollide = false
wait(0.01)
door.Transparency = 0
wait(0.01)
door.Transparency = 0.1
wait(0.01)
door.Transparency = 0.2
wait(0.01)
door.Transparency = 0.3
wait(0.01)
door.Transparency = 0.4
wait(0.01)
door.Transparency = 0.5
wait(0.01)
door.Transparency = 0.6
wait(0.01)
door.Transparency = 0.7
wait(0.01)
door.Transparency = 0.8
wait(0.01)
door.Transparency = 0.9
wait(0.01)
door.Transparency = 1
wait(0.01)
end
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)
<Now, I have combined both script into Group ID restriction Door>
local config = script.Parent.Configuration
script.Parent.Touched:connect(function(part)
if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
script.Parent.Transparency = 0.1
wait(0.01)
script.Parent.Transparency = 0.2
wait(0.01)
script.Parent.Transparency = 0.3
wait(0.01)
script.Parent.Transparency = 0.4
wait(0.01)
script.Parent.Transparency = 0.5
wait(0.01)
script.Parent.Transparency = 0.6
wait(0.01)
script.Parent.Transparency = 0.7
wait(0.01)
script.Parent.Transparency = 0.8
wait(0.01)
script.Parent.Transparency = 0.9
wait(0.01)
script.Parent.Transparency = 1
wait(0.01)
script.Parent.CanCollide = false
wait(1)
script.Parent.Transparency = 0.9
wait(0.01)
script.Parent.Transparency = 0.8
wait(0.01)
script.Parent.Transparency = 0.7
wait(0.01)
script.Parent.Transparency = 0.6
wait(0.01)
script.Parent.Transparency = 0.5
wait(0.01)
script.Parent.Transparency = 0.4
wait(0.01)
script.Parent.Transparency = 0.3
wait(0.01)
script.Parent.Transparency = 0.2
wait(0.01)
script.Parent.Transparency = 0.1
wait(0.01)
script.Parent.Transparency = 0
wait(0.01)
script.Parent.CanCollide = true
end
end
end)
When I walked in and door opens and closes with some transparency was buffering but not smooth? Please help.

1 comment
Use a loop for changing transparencies.