I added a loop and fixed the Chatted event and now the "end)" has a red line under it...
01 | local gate = script.Parent |
02 |
03 | Game.Players.PlayerAdded:connect( function (plr) |
04 | if plr.Chatted:connect( function (msg) |
05 | if msg = = "Open Lobby" then |
06 | if plr:GetRankInGroup( 947529 ) > = 5 then |
07 | if gate.Position = = Vector 3 (- 2.7 , 10.19 , - 0.3 ) then |
08 | for i = 1 , 22 do |
09 | gate.Position = gate.Position - Vector 3. new( 0 , 0.4 , 0 ) |
10 | wait( 0.1 ) |
11 | gate.Position = gate.Position + Vector 3. new( 0 ,. 2 , 0 ) |
12 | end |
13 | end |
14 | end |
15 | end |
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?
You added 'if" in front of plr.Chatted:connect(function(msg) with out 'then' after it, but those arnt necessary so I removed them. Second, you forgot to close you second function by adding an ')' after end. Hope this works, good luck!
01 | local gate = script.Parent |
02 |
03 | Game.Players.PlayerAdded:connect( function (plr) |
04 | plr.Chatted:connect( function (msg) |
05 | if msg = = "Open Lobby" then |
06 | if plr:GetRankInGroup( 947529 ) > = 5 then |
07 | if gate.Position = = Vector 3 (- 2.7 , 10.19 , - 0.3 ) then |
08 | for i = 1 , 22 do |
09 | gate.Position = gate.Position - Vector 3. new( 0 , 0.4 , 0 ) |
10 | wait( 0.1 ) |
11 | gate.Position = gate.Position + Vector 3. new( 0 ,. 2 , 0 ) |
12 | end |
13 | end |
14 | end |
15 | end |
01 | local gate = script.Parent |
02 |
03 | Game.Players.PlayerAdded:connect( function (plr) |
04 | plr.Chatted:connect( function (msg) -- WHY do you not lower the message? they will have to say EXACTLY that, with caps, for it to work. |
05 | if msg = = "Close Lobby" then |
06 | if plr:GetRankInGroup( 947529 ) > = 3 then |
07 | if gate.Position = = Vector 3 (- 2.7 , 28.19 , - 0.3 ) then -- WHY? Dude add a variable if it tells you open or closed, you can't guarantee it will be in that exact spot |
08 | for i = 1 , 22 do |
09 | gate.Position = gate.Position - Vector 3. new( 0 , 0.4 , 0 ) |
10 | wait( 0.1 ) |
11 | gate.Position = gate.Position + Vector 3. new( 0 ,. 2 , 0 ) |
12 | wait(. 1 ) |
13 | end |
14 | end |
15 | end |