player parameter without player added function?
Code:
01 | local x = game:GetService( "TweenService" ) |
03 | local gv = Instance.new( "BoolValue" , game.ReplicatedStorage) |
06 | local validRanks = { "Developer" , "Phoenix Guard" , "Peacekeeper" , "Council Members" , "Phoenix Council Members" , "Cardinal Witch/Warlock" , "Majestic Being" } |
08 | function playerIsValidRank(player) |
09 | local playerRank = player:GetRoleInGroup( 5527515 ) |
11 | for _, rank in pairs (validRanks) do |
12 | if playerRank = = rank then |
18 | game.Players.PlayerAdded:Connect( function (player) |
21 | local wplayer = game.Workspace:WaitForChild(player.Name) |
23 | player.Chatted:Connect( function (message) |
24 | local foundMessage = string.find(message:lower(), "colloportus" ) |
26 | if foundMessage and playerIsValidRank(player) then |
28 | local gate = game.Workspace.Gate |
30 | for i,v in pairs (gate:GetChildren()) do |
32 | local m = { Position = Vector 3. new(v.Position.X, v.Position.Y+ 29 , v.Position.Z) } |
33 | local t = x:Create(v, TweenInfo.new( 3.2 , Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0 , false , 0 ), m) |
41 | game.Players.PlayerAdded:Connect( function (player) |
42 | local playerrank = player:GetRoleInGroup( 5527515 ) |
44 | local wplayer = game.Workspace:WaitForChild(player.Name) |
46 | player.Chatted:Connect( function (message) |
47 | local foundMessage = string.find(message:lower(), "alohomora" ) |
49 | if foundMessage and playerIsValidRank(player) then |
50 | if gv.Value = = false then |
52 | local gate = game.Workspace.Gate |
54 | for i,v in pairs (gate:GetChildren()) do |
56 | local m = { Position = Vector 3. new(v.Position.X, v.Position.Y- 29 , v.Position.Z) } |
57 | local t = x:Create(v, TweenInfo.new( 3.2 , Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0 , false , 0 ), m) |
Basically, if 1 person joins, it works, but if 2 people join, it breaks
i need the player parameter without playeradded,playerleft