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

7 comments
Uh, please check that I had a bit of confused that your description thing.
Put the or statements in parenthesis.
Thank you royaltoe, but since I want to LEARN this, please explain what message:lower() does, thank you!
Royaltoe, there was one problem with the formatting (which i fixed) but if another player joins and says ANYTHING that meets the ranks it will go down, how can I fix that?
your script up a bit. message:lower() converts whatever the player says to lowercase and string.find() sees if the text colloportus is in the string. it needs to be lower case since caps matter.
ill edit your code to have the correct answer because i don't want to write a full answer to the post unless i fully know its solved.
edited comment. please let me know if you need more help by messaging me on discord. i don't check here often. Here's my discord: Lucy#0003