Door won't open! [Fixed]

I have a modulescript and a script, I want the door to only open for people on the “Guard” team, else a GUI label comes up. I have this code, however, the door will not open for the Guard team, and the warning label shows up. I’m absolutely stumped. Anybody have any ideas? Thanks.

ModuleScript in ServerScriptStorage
Tween = game:GetService("TweenService")
LeftBlast = game.Workspace.LeftBlastDoor.Union
RightBlast = game.Workspace.RightBlastDoor.Union
Sound = game.Workspace.CDCZController.DoorSound

function module:LBlastDoorOpen()

	local info = TweenInfo.new(
		4,
		Enum.EasingStyle.Quart,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)

	local goals = {
		Position = Vector3.new(-66.837, 14, -38.5)
	}
	

	LeftDoorOpenAnim = Tween:Create(LeftBlast, info, goals)
end

function module:RBlastDoorOpen()

	local info = TweenInfo.new(
		4,
		Enum.EasingStyle.Quart,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)

	local goals = {
		Position = Vector3.new(-66.837, 14, -93.5)
	}


	RightDoorOpenAnim = Tween:Create(RightBlast, info, goals)
end

function module:LBlastDoorClose() -- Ignore this function

	local info = TweenInfo.new(
		4,
		Enum.EasingStyle.Quart,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)

	local goals = {
		Position = Vector3.new(-66.837, 14, -56.5)
	}


	LeftDoorCloseAnim = Tween:Create(LeftBlast, info, goals)
end

function module:RBlastDoorClose() -- Ignore this function

	local info = TweenInfo.new(
		4,
		Enum.EasingStyle.Quart,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)

	local goals = {
		Position = Vector3.new(-66.837, 14, -75.5)
	}


	RightDoorCloseAnim = Tween:Create(RightBlast, info, goals)
end

function module:CDCZOpenBlastDoors()
	module:RBlastDoorOpen()
	module:LBlastDoorOpen()
	LeftDoorOpenAnim:Play()
	RightDoorOpenAnim:Play()
	Sound:Play()
end

function module:CDCZCloseBlastDoors()
	module:RBlastDoorClose()
	module:LBlastDoorClose()
	LeftDoorCloseAnim:Play()
	RightDoorCloseAnim:Play()
	Sound:Play()
end
return module

Door Open Script
ProxPrompt = script.Parent.ProximityPrompt
Doorstatus = "Closed"


local function control(Player)
	if Doorstatus == "Closed" then
		if Player.Team == "Guard" then		
			Doorcontroller:CDCZOpenBlastDoors()
		else
			Player.PlayerGui.TeamWarning.Enabled = true
			wait(3)
			Player.PlayerGui.TeamWarning.Enabled = false
		end
	elseif Doorstatus == "Open" then	
		-- Close door
	end
end

ProxPrompt.Triggered:Connect(control)


You need to do

if Player.Team == game.Teams.Guard

In short:- The Team property points to the Team instance inside game:GetService("Teams")

1 Like

Unfortunately, same result occured, the door did not open and the UI warning still showed.

Could you show me your Teams explorer.

image

Can you print the Player.Team and tell me the results? And is the team’s AutoAssignable set to true?

On guard team, prints “Prisoner”, both are indeed autoassignable

I have just solved the issue by making the team colours of both teams different, yup, that was literally it. Thanks anyways!

And what is the Team property of the SpawnLocation? Many people dont know this but u need to set the SpasmwnLocation's Team prooerty to ur specified team for it to actually assign the Team to the player.

Oh cool glad I cud b of help then.

1 Like