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)