I have a door script that works completely fine until I had an if statement on which team the player is in. I've tried and I feel like this would make sense but it doesn't work.
local ts = game:GetService("TweenService") local tweeninfo2 = TweenInfo.new(3.75) local goalA = {} goalA.Position = Vector3.new(-67.107, 14.625, -17.316) local tweenA = ts:Create(script.Parent, tweeninfo2, goalA) local goalB = {} goalB.Position = Vector3.new(-67.107, 21.875, -17.316) local tweenB = ts:Create(script.Parent,tweeninfo2, goalB) local opened = false script.Parent.ClickDetector.MouseClick:Connect(function(player) local Team = game:GetService("Teams")["Administrator"] if player.Team == Team then print(player.Name) print(player.Name .. " is an Administrator.") opened = true script.Parent["Sliding door 2"].Playing = true tweenB:Play() wait(7) script.Parent["Sliding door 2"].Playing = true tweenA:Play() wait(1) opened = false end end)
Might be obvious but try this:
local ts = game:GetService("TweenService") local tweeninfo2 = TweenInfo.new(3.75) local goalA = {} goalA.Position = Vector3.new(-67.107, 14.625, -17.316) local tweenA = ts:Create(script.Parent, tweeninfo2, goalA) local goalB = {} goalB.Position = Vector3.new(-67.107, 21.875, -17.316) local tweenB = ts:Create(script.Parent,tweeninfo2, goalB) local opened = false script.Parent.ClickDetector.MouseClick:Connect(function(player) local Team = game:GetService("Teams") local Admin_Team = Team:FindFirstChild("Administrator") if(Admin_Team == nil) then warn("warning!: there is no team named Administrator in the Teams Service! \n ADMINS WHERE ARE YOUS!!!!!") end if player.Team == Admin_Team then print(player.Name) print(player.Name .." is an Administrator.") opened = true script.Parent["Sliding door 2"].Playing = true tweenB:Play() wait(7) script.Parent["Sliding door 2"].Playing = true tweenA:Play() wait(1) opened = false end end)