local Hinge = script.Parent.PrimaryPart local opened = false local Promt = script.Parent:WaitForChild("ProximityPrompt") function OpenDoor() if opened == false then opened = true for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0)) wait() end else opened = false for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0)) wait() end end end Promt.Triggered:Connect(function(Players) OpenDoor() end) script.Parent.Door1.ProxomityPrompt.Triggered:Connect(OpenDoor)
This is the script How can i make it only for a certain team
https://developer.roblox.com/en-us/api-reference/property/Player/Team
You could do an if statement like this
if Player.Team == "YourTeamName" then -- Your code end
The way I have done this is by checking the player's team value against a team instance:
local Hinge = script.Parent.PrimaryPart local opened = false local Promt = script.Parent:WaitForChild("ProximityPrompt") function OpenDoor(player) if not player.Team == game.Teams.YOUR_TEAM_NAME_HERE then return end -- Change YOUR_TEAM_NAME_HERE to your team name if opened == false then opened = true for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0)) wait() end else opened = false for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0)) wait() end end end Promt.Triggered:Connect(function(Players) OpenDoor() end) script.Parent.Door1.ProxomityPrompt.Triggered:Connect(OpenDoor)
local Hinge = script.Parent.PrimaryPart local opened = false local Promt = script.Parent:WaitForChild("ProximityPrompt") function OpenDoor(player) if opened == false then if not player.TeamColor == "ColorOfTeam" then return end opened = true for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0)) wait() end else if not player.TeamColor == "ColorOfTeam" then return end opened = false for i = 1, 21 do script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0)) wait() end end end Promt.Triggered:Connect(function(Players) OpenDoor() end) script.Parent.Door1.ProxomityPrompt.Triggered:Connect(OpenDoor)