Outfit Changer Issue

script.Parent.Touched:Connect(function(hit)
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	local Character = Player.Character
	
	if Player:GetRankInGroup(4789894) <= 255 then
		local Shirt = Character.Shirt
		local Pants = Character.Pants
		
		if not Shirt then
			Instance.new("Shirt", Character)
			
			if not Pants then
				Instance.new("Pants", Character)
				
				Pants.PantsTemplate = script.Parent.Uniform.LR.Pants.PantsTemplate
				Shirt.ShirtTemplate = script.Parent.Uniform.LR.Shirt.ShirtTemplate
			end	
		end
	end
end)

Hey there, I am trying to give a player an outfit when they touch a part. However, this doesn’t work and I’m not sure why.

script.Parent.Touched:Connect(function(hit)
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	local Character = Player.Character

	if Player:GetRankInGroup(4789894) <= 255 then
		local Shirt = Character.Shirt
		local Pants = Character.Pants

		if not Shirt then
			Shirt = Instance.new("Shirt", Character)
		end

		if not Pants then
			Pants = Instance.new("Pants", Character)
		end	
		
		Pants.PantsTemplate = script.Parent.Uniform.LR.Pants.PantsTemplate
		Shirt.ShirtTemplate = script.Parent.Uniform.LR.Shirt.ShirtTemplate
	end
end)
1 Like

Thank you! Appreciate it.

charchar