I am making a game at the moment that has 2 teams, and I have made sliding doors that can open when clicked on it only by one of those teams. However, when I switch teams (with a Team Change ScreenGui I set up) , the door does not open. Even being on the right team works - weird enough using Adonis seems to make it work (by using a basic team change command).
This is how I set the script up:
local TweenService = game:GetService("TweenService")
local Door = script.Parent.Union
local TweeningInformation = TweenInfo.new(
2,
enum.EasingStyle.Quad,
enum.EasingDirection.Out,
0,
false,
0
)
local Dooropen = {CFrame = CFrame.new(-93.9, 5.1, -150.9)}
local Doorclose = {CFrame = CFrame.new(-88.1, 5.1, -150.9)}
local Tweenopen = TweenService:Create(Door,TweeningInformation,Dooropen)
local TweenClose = TweenService:Create(Door,TweeningInformation,Doorclose)
local Team = game.Teams.Officer
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if script.Parent.ClickDetector.MouseClick then
if plr.Team == Team then
Tweenopen:Play()
script.Parent.close.Disabled = false
script.Disabled = true
end
end
end)
This seems to work fine if I'm already on the right Team, however if I change Teams with the ScreenGui (which fully functions to change the local players team), it doesn't allow me to open the doors whatsoever.
I use a Group Rank only Team change (which works fine, but of course if it were working I wouldn't be here).
local Group = 4720329
local GroupRank = 4
local bc = BrickColor.new("Cyan")
local Frame = script.Parent.Parent.Parent.Parent.Background
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent:GetRankInGroup(Group) >= GroupRank then
wait(1)
script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
script.Parent.Parent.Parent.Parent.Parent.Parent.TeamColor = bc
Frame:TweenPosition(UDim2.new(1,0,0.227,0),'Out','Quad')
end
end)
Help with this situation would be much appreciated. I'm trying to get this game I'm using it for out to the public in the next week or so - so finding out a way to make this work would be great.

4 comments
Can you post the code from your team change script
Oh yea, of course.
There we go - edited in.
Nevermind. Got it figured out.