How to make a Team Door ( Need Help )

How do i script a Team Door like:

Only Red Team can go inside of the Red Team base
Only Blue Team can go inside of the Blue Team base

Anyone help pls for my new game called “Blox Minigames”

2 Likes
local Players = game:GetService("Players")
 
local door = game.Workspace.Door
 
local debounce = false 
 
door.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		if hit then
			local player = Players:GetPlayerFromCharacter(hit.Parent)
			if player and player.TeamColor == BrickColor.new("Bright red") then --You can change bright red to your desired team color
				door.Transparency = 0.5
				door.CanCollide = false 
				wait(3)
				door.Transparency = 0
				door.CanCollide = true
			end
		end
		wait(0.5)
		debounce = false
	end
end)

Here it is.

Where do i put it? @Stickmanfanrdc

A server script, inside the door, or in serverscriptservice

If you put the script inside the door, you can write, instead of local door = game.Workspace.Door,
you can use local door = script.parent

Thank you so much @Stickmanfanrdc

Np.If this worked, mark my answer as the solution.(Also, this is made for a Bright Red team)

2 Likes

Thank you so much @Stickmanfanrdc for the Scripting help