Places that dont need changed are the gate.Position lines! I just want it to move when i say "Close Spawns"/"Open Spawns", but i only want rank 5 and higher in the group to be able to...and i don't want it to move if it is already closed/opened.
local gate = script.Parent Game.Players.PlayerAdded:connect(function(plr) if plr.Chatted == "Open Spawns" then if plr:GetRankInGroup(947529) >= 5 then if gate.Position == Vector3(-2.7, 10.19, -0.3)then gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position + Vector3.new(0,.2,0) wait(.1) end end end end) local gate = script.Parent Game.Players.PlayerAdded:connect(function(plr) if plr.Chatted == "Open Spawns" then if plr:GetRankInGroup(947529) >= 3 then if gate.Position == Vector3(-2.7, 28.19, -0.3)then gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.4,0) wait(.1) gate.Position = gate.Position - Vector3.new(0,.2,0) wait(.1) end end end end)
Chatted is an event, and you have to :connect() a function to it, like you would with game.Players.PlayerAdded. An example:
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) if message == 'hi' then print(player.Name .. ' says hi!') end end) end)
Also, for the love of god, use a for loop.
for i=1, 30 do -- 30 was a guess. gate.Position = gate.Position - Vector3.new(0, 0.4, 0) wait(0.1) end
Instead of adding numerous lines of code why not use a for statement to move the gates? Also try adding in a BoolValue. Add some code to when the gates opens/closes it sets to true/false. Then do an if statement to check the boolean. For the member of a certain rank and above I'm not sure on that, sorry. :(
Best of luck!