Hey there friend, I made a post about allowing a specific team able to open a door, yet now I switched to ProximityPrompts. I tried using the same code for one team, it worked, yet I want MORE TEAMS. So I used the code from last time yet instead of one team, I have a variable with about 7 teams listed. I have my team service, player service, and get player variables to see if the player is on that team, yet it doesn’t work.
So my goal basically is to get a fully functional door only to specific teams, yet anyone on a team other…the door will do nothing.
My issue is plain and simple, the code/door just breaks…nothing works.
So far, I have this for the variable and team service.
local plr = game:GetService("Players").LocalPlayer
local Teams = game:GetService("Teams")
local teamsallowed = {
"Specialized Medical Department",
"Research Division",
"Assistant Authoritor",
"Manufacturer",
"Deputy Authoritor"
}
Here is the full source code:
local Hinge = script.Parent.Hinge
local opened = false
local Promt1 = script.Parent.Parent.Keycard1.Union.ProximityPrompt
local Promt2 = script.Parent.Parent.Keycard2.Union.ProximityPrompt
local plr = game:GetService("Players").LocalPlayer
local Teams = game:GetService("Teams")
local teamsallowed = {
"Specialized Medical Department",
"Research Division",
"Assistant Authoritor",
"Manufacturer",
"Deputy Authoritor"
}
function OpenDoor1()
if opened == false and plr.Team == Teams[teamsallowed] then
opened = true
Promt1.ActionText = "Close"
script.Parent.SoundPart.Granted:Play()
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0))
wait()
end
else
opened = false
Promt1.ActionText = "Open"
script.Parent.SoundPart.Granted:Play()
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0))
wait()
end
end
end
Promt1.Triggered:Connect(function(Players)
OpenDoor1()
end)
function OpenDoor2()
if opened == false and plr.Team == Teams[teamsallowed] then
opened = true
Promt2.ActionText = "Close"
script.Parent.SoundPart.Granted:Play()
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0))
wait()
end
else
opened = false
Promt2.ActionText = "Open"
script.Parent.SoundPart.Granted:Play()
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0))
wait()
end
end
end
Promt2.Triggered:Connect(function(Players)
OpenDoor2()
end)
I don’t know how to do this, so any help is appreaciated!
-lcey