It works perfectly except everytime a group member passes through the door it lets a player thats not in the group pass also. I need to type a script where it only opens the door to the player who is in the group. Where do i need to do the function?
GroupId = 3366998
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr:IsInGroup(GroupId) then
script.Parent.Transparency = 0.7
script.Parent.CanCollide = false
wait(2)
script.Parent.Transparency = 0.15
script.Parent.CanCollide = true
end
end)
Than I did this but it still didn't work.
GroupId = 3366998
local Debounce = false;
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and plr:IsInGroup(GroupId) and Debounce == false then
Debounce = true;
script.Parent.Transparency = 0.7
script.Parent.CanCollide = false
wait(2)
script.Parent.Transparency = 0.15
script.Parent.CanCollide = true
Debounce = false;
end
end)
