So I am trying to make an invisible door that you can walk through, and once walked through it will select the right uniform based on your rank within the group and put it on you. I've tried various ways and nothing seems to be working. My Lua knowledge is very small so I don't even know if I am close or horribly wrong.
local GroupId = 4217419 game.Players.PlayerAdded:Connect(function(plr) script.Parent.Touched:Connect(function(hit) if plr:GetRankInGroup(GroupId) == 247 and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Shirt.ShirtTemplate = "rbxassetid://2165624791" hit.Parent.Pants.PantsTemplate = "rbxassetid://2165669286" elseif plr:GetRankInGroup(GroupId) == 248 and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Shirt.ShirtTemplate = "rbxassetid://2165624316" hit.Parent.Pants.PantsTemplate = "rbxassetid://2165669286" elseif plr:GetRankInGroup(GroupId) == 249 and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Shirt.ShirtTemplate = "rbxassetid://2165624316" hit.Parent.Pants.PantsTemplate = "rbxassetid://2165669286" elseif plr:GetRankInGroup(GroupId) == 250 and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Shirt.ShirtTemplate = "rbxassetid://2165632105" hit.Parent.Pants.PantsTemplate = "rbxassetid://2165673300" elseif plr:GetRankInGroup(GroupId) >= 251 and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Shirt.ShirtTemplate = "rbxassetid://2165667431" hit.Parent.Pants.PantsTemplate = "rbxassetid://2165669286" end end)