Code:
local x = game:GetService("TweenService") local gv = Instance.new("BoolValue", game.ReplicatedStorage) gv.Value = false -- open local validRanks = {"Developer", "Phoenix Guard", "Peacekeeper", "Council Members","Phoenix Council Members", "Cardinal Witch/Warlock","Majestic Being" } function playerIsValidRank(player) local playerRank = player:GetRoleInGroup(5527515) for _, rank in pairs(validRanks)do if playerRank == rank then return true end end end game.Players.PlayerAdded:Connect(function(player) print(playerRank) local wplayer = game.Workspace:WaitForChild(player.Name) player.Chatted:Connect(function(message) local foundMessage = string.find(message:lower(), "colloportus") if foundMessage and playerIsValidRank(player) then gv.Value = false local gate = game.Workspace.Gate for i,v in pairs(gate:GetChildren()) do local m = {Position = Vector3.new(v.Position.X, v.Position.Y+29, v.Position.Z)} local t = x:Create(v, TweenInfo.new(3.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), m) t:Play() end end end end) end) game.Players.PlayerAdded:Connect(function(player) local playerrank = player:GetRoleInGroup(5527515) print(playerrank) local wplayer = game.Workspace:WaitForChild(player.Name) player.Chatted:Connect(function(message) local foundMessage = string.find(message:lower(), "alohomora") if foundMessage and playerIsValidRank(player) then if gv.Value == false then gv.Value = true local gate = game.Workspace.Gate for i,v in pairs(gate:GetChildren()) do local m = {Position = Vector3.new(v.Position.X, v.Position.Y-29, v.Position.Z)} local t = x:Create(v, TweenInfo.new(3.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), m) t:Play() end end end end) end)
Basically, if 1 person joins, it works, but if 2 people join, it breaks i need the player parameter without playeradded,playerleft