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)

4 comments
Is the part that you are selecting CanCollide true? Also, is this a Script, not a LocalScript? And, Are there any errors? Just some thigns I need to know because your script looks okay
It's a Script, no errors and my part is CanCollide false I think if be able to walk through it is false then it's false, but the thing is when I walk through the block it doesn't show anything happening in the output view.
The ShirtTemplate and the PantsTemplate are both instde the Shirt?
I've changed it and still no errors and nothing showing up in the output view. I also edited my first post at the top of this page to the updated version it's what my script is right now.